How to install Docker and run Jupyter notebook with Deep learning libraries (Ubuntu 16.04)

The blog is about step by step procedure to install docker in Ubuntu 16.04 and use the docker by running Jupyter notebook with deep learning libraries.

Step 1: Update the system and install the docker dependencies.

sudo apt-get update

sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common

Step 2 Add docker official key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –

Step 3 Verify the docker key

sudo apt-key fingerprint 0EBFCD88

Step 4 Add the stable docker repository

sudo add-apt-repository \
“deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable”

Step 5 Update the package index

sudo apt-get update

Step6 Install the latest version of Docker CE and container

sudo apt-get install docker-ce docker-ce-cli containerd.io

Step 7 Verify that docker is installed by running docker hello world container

sudo docker run hello-world

If you get the hello-world Docker installation is completed.

Lets use the docker by pulling the Docker image. I am using all in one deep learning docker image of docker hub to show how to use docker. Image have tensorflow , keras , caffe , opencv and others deep leaning library. Below is the link of docker hub for all in one deep learning docker image you can check the details of image.

https://hub.docker.com/r/floydhub/dl-docker/

Step8 Pull the docker image

sudo docker pull floydhub/dl-docker:cpu

Step 9 Run the docker image

docker run -it -p 8888:8888 -p 6006:6006 -v /sharedfolder:/root/sharedfolder floydhub/dl-docker:cpu bash

Above command – p is for port forwarding from docker to system and – v is share a folder from system to docker you need to edit path . I am sharing cv_basics folder to docker with name my_folder. You can give any name while sharing.

In my case command is

docker run -it -p 8888:8888 -p 6006:6006 -v /home/lord/cv_basics/:/root/my_folder floydhub/dl-docker:cpu bash

Now we are inside the docker container. Give execute permission and run the jupyter notebook.

sudo chmod +x run_jupyter.sh

sudo ./run_jupyter.sh

open browser in system and type http://localhost:8888

Check the docker pulled images and docker containers in system.

sudo docker images

sudo docker ps -a

We can see I have two docker images and two excited container in my system.

Happy learning


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s