Skip to content

Latest commit

 

History

History
101 lines (72 loc) · 3.4 KB

Docker-tutorial.md

File metadata and controls

101 lines (72 loc) · 3.4 KB

Docker container with course dependencies

This file describes how to use a Docker container with Jupyter notebook and all dependencies required for the course.

The image is located at https://hub.docker.com/r/akashin/coursera-aml-nlp/.

Install Stable Docker Community Edition (CE)

Get container image

To get the latest version of the container image run:

docker pull akashin/coursera-aml-nlp

It containes Ubuntu 16.04 Linux distirbutive and all dependencies that you need for our course. The downloaded image takes approximately 2.3GB.

Note: If you are getting an error "Got permission denied while trying to connect to the Docker daemon socket...", you need to add current user to the docker group:

sudo usermod -a -G docker $USER
sudo service docker restart

Then you need to logout and login to the system again (disconnect and connect to your AWS instance if you are setting up a docker on it).

Run container for the first time

Now you can start new container from this image with:

docker run -it -p 127.0.0.1:8080:8080 --name coursera-aml-nlp akashin/coursera-aml-nlp

This will start the Ubuntu instance and give you an access to its command line. You can type run_notebook to launch IPython notebook server.

You may find it useful to mount a directory from your local machine within the container using -v option:

docker run -it -p 127.0.0.1:8080:8080 --name coursera-aml-nlp -v $PWD:/root/coursera akashin/coursera-aml-nlp

This will use shell alias $PWD to mount current directory to the folder /root/coursera in the container. Alternatively, you can mount arbitrary directory by replacing $PWD with a custom path.

Stop and resume container

To stop the container use:

docker stop coursera-aml-nlp

All the changes that were made within container will be saved.

To resume the stopped container use:

docker start -i coursera-aml-nlp

Other operations on the container

There are many other operations that you can perform on the container, to show all of them:

docker container

Some particularly useful would be showing a list of containers and removing container.

To show currently running and stopped containers with their status:

docker ps -a

To remove the container and all data associated with it:

docker rm coursera-aml-nlp

Note, that this will remove all the internal data of the container (e.g. installed packages), but all the data written inside of your local mounted folder (-v option) will not be affected.

Install more packages

You can install more packages in the container if needed:

docker exec coursera-aml-nlp pip3 install PACKAGE_NAME

Further reading

If you are interested to know more about Docker, check out this articles:

Credits

The template for this dockerfile was taken from https://github.com/ZEMUSHKA/coursera-aml-docker