Hi everyone, today we'll learn about installing and upgrading to the latest Docker 1.7. Docker is a open source technology that provides an open platform to pack, ship and run any application as a lightweight container. It has no boundaries of Language support, Frameworks or packaging system and can be run anywhere, anytime from a small home computers to high-end servers. It makes them great building blocks for deploying and scaling web apps, databases, and back-end services without depending on a particular stack or provider. As we know that the latest version of Docker ie 1.7 has been released. This release of Docker consists of heavy updates on Engine, Compose, Swarm and Machine which are a part of this Technology. It includes a heavy update with hard work of the Docker Team and the community to improve the quality of the project. This release has introduced new networking and plugins systems in Engine whereas the networking and volumes systems have been completely rewritten. Currently, these new features networking and plugins system are in experimental release of the Docker Engine. Besides, experimental release, it has been focused on its stability and quality in order to make it ready for the production. It includes some of the awesome features included in the stable release 1.7 are as follows.
- ZFS storage driver for the support of storing images in ZFS.
- The Engine’s networking internals have been split out into a separate reusable library, libnetwork which makes the networking internals much higher quality allowing to set a daemon-wide default gateway for containers.
- The volumes internals have been completely rewritten to make them cleaner and higher quality.
- Loads of other internals have been refactored to make them faster, more stable and easier to maintain.
So, here are some easy to perform steps on installing and upgrading the latest version of Docker 1.7 in a Linux Operating System.
1) Uninstalling old Docker
First of all, before we start installing we'll need to verify if we have got a previous version of docker installed in the box or not. If there is a previous version running in the box, we'll surely wanna upgrade it to the latest version 1.7 by following this tutorial. To check which version of docker we have in our box, we can simply run the following command.
# docker --version Docker version 1.6.0, build 9d26a07/1.6.0
Then, we'll wanna stop the running docker daemon if any.
# systemctl stop docker
# service docker stop
After we successfully stop the docker daemon, we'll gonna go for uninstalling the previous version of docker. This will not remove or delete our docker images, containers and configurations, it will only remove the old version of docker from our system.
2) Installing the latest Docker 1.7
Now, after we have successfully removed the previous version of docker daemon if any. We'll now wanna install the latest Docker 1.7 in our box running linux operating system. Here are some steps below on installing docker in some varieties of linux distributions like Ubuntu, Fedora, CentOS, RHEL, Debian and Arch Linux.
On Ubuntu 15.04/14.04/12.04
Before installing Docker 1.7 in our Ubuntu machine, we'll need to make sure that we have the version of linux kernel installed greater than 3.10. To check what version of kernel we're running, we can simply run the following command.
$ uname -r
To upgrade the kernel to the latest available version, we'll run the below command in a shell or a console.
$ sudo apt-get update $ sudo apt-get install linux-image-generic-lts-trusty $ sudo reboot
Note: If you are running Ubuntu versions 12.04/14.04 LTS, you are highly recommended to follow the above process and upgrade your kernel to the latest available version.
After upgrading the kernel, we'll gonna finally go for the installation process. Before going further for installation, we'll need make sure that wget is installed and is available.
$ sudo apt-get update $ sudo apt-get install wget
Then, we'll gonna run the following command in order to install the latest version of Docker ie 1.7 in our Ubuntu box.
$ wget -qO- https://get.docker.com/ | sh
Finally we've successfully installed docker 1.7 in our Ubuntu machine.
On Fedora 22 / 21
Docker is currently supported on Fedora 22 and 21. So, we should just keep in mind that our version of kernel running in our operating system must be greater than 3.10 and should be fully patched from the potential bugs. To check the kernel version we can simply run the following command in a shell or a console.
$ uname -r 4.0.6-300.fc22.x86_64+debug
Now, to install Docker 1.7 in our fedora machine, we'll need to follow the following steps. First of all we'll need to download the rpm binary package of our latest docker using curl and then install it using yum package manager.
On Fedora 21
$ curl -O -sSL https://get.docker.com/rpm/1.7.0/fedora-21/RPMS/x86_64/docker-engine-1.7.0-1.fc21.x86_64.rpm $ sudo yum localinstall --nogpgcheck docker-engine-1.7.0-0.1.fc21.x86_64.rpm
Now, if we wanna install docker in fedora 22, we'll wanna use dnf package manager to install the downloaded rpm package.
On Fedora 22
$ curl -O -sSL https://get.docker.com/rpm/1.7.0/fedora-22/RPMS/x86_64/docker-engine-1.7.0-1.fc22.x86_64.rpm $ sudo dnf install docker-engine-1.7.0-1.fc22.x86_64.rpm
On CentOS 7/6.5 and RHEL 7/6.6
If you are running CentOS version 7/6.5 or running RHEL version 7/6.6, we can easily install Docker 1.7 on it. As CentOS 7 and RHEL 7 runs the kernel version greater than 3.10, we may no need to upgrade our kernel. But as CentOS 6.5 and RHEL 6.6 runs older kernel versions, we'll need to upgrade them to 2.6.32-431 or higher. To check the kernel version we can simply run the following command in a shell or a console.
$ uname -r
After we have required kernel running in our system, we'll now head ahead for the installation of Docker 1.7 on it. The docker rpm package for both the CentOS 6.5 and RHEL 6.6 is the same as well as with CentOS 7 and RHEL 7. So, the procedure for both of the them is exactly the same as shown below.
On CentOS 6.5 or RHEL 6.6
If we are running CentOS 6.5 or RHEL 6.6, we need to simply run the following command in a terminal or a console.
$ curl -O -sSL http://get.docker.com/docker/1.7.0/rpms/centos-6/RPMS/x86_64/docker-engine-1.7.0-0.1.el6.x86_64.rpm $ sudo yum localinstall --nogpgcheck docker-engine-1.7.0-0.1.el6.x86_64.rpm
On CentOS 7 or RHEL 7
If we are running CentOS 7 or RHEL 7, we need to simply run the following command as above.
$ curl -O -sSL https://get.docker.com/rpm/1.7.0/centos-7/RPMS/x86_64/docker-engine-1.7.0-1.el7.centos.x86_64.rpm $ sudo yum localinstall --nogpgcheck docker-engine-1.7.0-1.el7.centos.x86_64.rpm
On Debian 7.x / 8.x
As the latest stable version of Debian ie 8.x "Jessie" comes with linux kernel 3.16, we no need to upgrade its kernel to install Docker 1.7 on it but the old stable version of Debian ie 7.x "Wheezy" comes with the kernel 3.2, it needs to be upgraded to kernel 3.8+. We can upgrade the kernel in Wheezy using the wheezy-backports repository to version 3.16 which is officially supported by Docker. To enable the wheezy-backports in our Wheezy box, we'll need to edit /etc/apt/sources.list and add a line as shown below.
$ sudo nano /etc/apt/sources.list
Then, we'll add the following line in it.
deb http://http.debian.net/debian wheezy-backports main
Then, we'll wanna save and exit then run the following commands to upgrade our kernel version to 3.16.
$ sudo apt-get update $ sudo apt-get install -t wheezy-backports linux-image-amd64
After reboot, we're ready to install the latest version 1.7 in our Debian 8 or 7.x box. To do so, we'll need to execute the following command.
$ wget -qO- https://get.docker.com/ | sh
Finally, we've successfully install docker 1.7 in our debian box.
On Arch Linux
If you have a box running Arch Linux, we can install docker using pacman package manager. Pacman fetches the latest build of docker and then installs it into the box from the repository which is maintained by the Community. As Arch Linux is a rolling release distribution, the installed kernel in your box is assumed to be the latest. So, to install docker 1.7 in our Arch Linux box, we need to run the following command in a terminal or a console.
$ sudo pacman -S docker
The above command will install along-with the required dependencies bridge-utils, device-mapper, iproute2, sqlite, systemd, lxc, btrfs-progs, git, go, go-md2man.
3) Adding User to Docker Group
After we have successfully installed Docker 1.7 in our machine running respective distribution of linux, we'll now need to create a new group in the operating system named docker.
$ sudo groupadd docker
Then, we'll wanna add our user that we use to run and manage docker and docker containers respectively to the docker group. To do so, we'll simply run the following command.
$ sudo usermod -aG docker arun
Then, we'll wanna logout and login the system to apply the changes.
Note: Here, in the above command, docker is the group that we wanna create which is followed by the user that we want to get added into the group docker. Please replace arun with the username you use to run and manage the docker containers.
This will allow docker daemon to provide permission to the users under group docker to have authentication to run and manage the docker and containers.
4) Starting the Docker Daemon
Now, after we have installed docker i and created the docker group, we'll wanna start our Docker Daemon so that we can configure, run and manage the containers in our linux machine. To do so, we'll need to run the following command,
$ sudo systemctl start docker
$ sudo service docker start
5) Checking the version
Now, after we have installed our docker, we'll surely wanna check the version of docker installed in our system so that we can ensure that we are running version 1.7 . To do so, we can simply run the following command.
$ docker -v Docker version 1.7.0, build 0baf609
6) Running Docker Container
Next, as all the required stuffs to run a container are completely installed and configured in our machine, we'll now wanna run a docker container out of the box. Here, in this tutorial, we'll run a simple Hello World container. To do so, we'll gonna run the following command in the terminal.
$ docker run hello-world Hello from Docker.
This verifies that we have successfully and properly installed the latest version 1.7 in our linux distribution. To check whether we have successfully upgraded to the latest version or not, we can simply check our old images and containers we had setup with our previous version.
$ docker images $ docker ps -a
As we can see there is old images and containers available, this verifies that we have successfully upgraded our system from previous version to the latest version 1.7.
We have successfully installed and upgraded our system with the latest version of Docker. Its installation is pretty easy with the above tutorial. We can now deploy any docker image that we can find from the Docker Hub and create our own docker image and deploy them. In this tutorial, we installed docker 1.7 in different linux distributions like Ubuntu, Fedora, CentOS, RHEL, Debian and Arch Linux. The above tutorial includes method for the installation only in the distributions that are official supported. It only supports 64-bit operating systems as it currently doesn't support 32-bit operating systems so, this article is only applicable for the 64-bit architecture of operating systems. If you have any questions, suggestions, feedback please write them in the comment box below so that we can improve or update our contents. Thank you ! Enjoy :-)