Hello everyone, today I am going to show you how to install Docker Community Edition on Ubuntu 16.04 server. This is the Docker official way to get the latest version of Docker. Its pretty simple to install this Docker CE. We have been tested this tutorial on Ubuntu 16.04.2 server edition.
Steps to install Docker Community Edition on Ubuntu 16.04
Step 1. Setup the repository
First, we need to install some packages and setup the official Docker repository on Ubuntu 16.04. Connect to Ubuntu 16.04 via SSH and copy paste the following command. I recommend to use copy and paste to avoid misspelling on the commands.
Install required packages
sudo apt-get -y install \ apt-transport-https \ ca-certificates \ curl
Add the GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Add the repository
sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"
Update Ubuntu
sudo apt update
Step 2. Install Docker
sudo apt install docker-ce
Output:
dhani@ubuntu:~$ sudo apt install docker-ce Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: aufs-tools cgroupfs-mount libltdl7 Suggested packages: mountall The following NEW packages will be installed: aufs-tools cgroupfs-mount docker-ce libltdl7 0 upgraded, 4 newly installed, 0 to remove and 8 not upgraded. Need to get 19.4 MB of archives. After this operation, 89.4 MB of additional disk space will be used. Do you want to continue? [Y/n]
Step 3. Verify the installation
Now we need to check if Docker CE is correctly installed.
dhani@ubuntu:~$ docker -v Docker version 17.03.1-ce, build c6d412e
Check Docker Daemon status
dhani@ubuntu:~$ sudo systemctl status docker ● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2017-05-11 08:32:20 WIB; 2min 12s ago Docs: https://docs.docker.com Main PID: 21360 (dockerd) CGroup: /system.slice/docker.service ├─21360 /usr/bin/dockerd -H fd:// └─21365 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --st May 11 08:32:19 ubuntu dockerd[21360]: time="2017-05-11T08:32:19.502523762+07:00" level=warning msg="Your kernel does not support cgroup rt peri May 11 08:32:19 ubuntu dockerd[21360]: time="2017-05-11T08:32:19.502816780+07:00" level=warning msg="Your kernel does not support cgroup rt runt May 11 08:32:19 ubuntu dockerd[21360]: time="2017-05-11T08:32:19.503677034+07:00" level=info msg="Loading containers: start." May 11 08:32:19 ubuntu dockerd[21360]: time="2017-05-11T08:32:19.731189910+07:00" level=info msg="Firewalld running: false" May 11 08:32:20 ubuntu dockerd[21360]: time="2017-05-11T08:32:20.263729462+07:00" level=info msg="Default bridge (docker0) is assigned with an I May 11 08:32:20 ubuntu dockerd[21360]: time="2017-05-11T08:32:20.552549585+07:00" level=info msg="Loading containers: done." May 11 08:32:20 ubuntu dockerd[21360]: time="2017-05-11T08:32:20.680553277+07:00" level=info msg="Daemon has completed initialization" May 11 08:32:20 ubuntu dockerd[21360]: time="2017-05-11T08:32:20.681599787+07:00" level=info msg="Docker daemon" commit=c6d412e graphdriver=aufs May 11 08:32:20 ubuntu systemd[1]: Started Docker Application Container Engine. May 11 08:32:20 ubuntu dockerd[21360]: time="2017-05-11T08:32:20.698472290+07:00" level=info msg="API listen on /var/run/docker.sock" lines 1-19/19 (END)
Now try to run Hello World using Docker command as follow:
root@ubuntu:~# docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 78445dd45222: Pull complete Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://cloud.docker.com/ For more examples and ideas, visit: https://docs.docker.com/engine/userguide/
Leave a Reply