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/.
-
For Ubuntu: https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/ (see also other Linux distributives in the menu).
-
For Windows (64bit Windows 10 Pro, Enterprise and Education): https://docs.docker.com/docker-for-windows/install/
-
For Windows (older versions): https://docs.docker.com/toolbox/toolbox_install_windows/
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).
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.
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
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.
You can install more packages in the container if needed:
docker exec coursera-aml-nlp pip3 install PACKAGE_NAME
If you are interested to know more about Docker, check out this articles:
- Using Jupyter notebook from Docker: https://www.dataquest.io/blog/docker-data-science/
- General introduction to Docker: https://docker-curriculum.com/
The template for this dockerfile was taken from https://github.com/ZEMUSHKA/coursera-aml-docker