Part 2: Docker CE and Docker Compose installation with ubuntu
Docker CE for Ubuntu
To install Docker CE, you need the 64-bit version of one of these Ubuntu versions:
- Artful 17.10 (Docker CE 17.11 Edge and higher only)
- Zesty 17.04
- Xenial 16.04 (LTS) My blog on this version
- Trusty 14.04 (LTS)
$ lsb_release -aNo LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
Docker CE is supported on Ubuntu on x86_64
, armhf
, s390x
(IBM Z), and ppc64le
(IBM Power) architectures.
$ uname -aLinux name-HP-15-Notebook-PC 4.4.0-112-generic #135-Ubuntu SMP Fri Jan 19 1:48:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Uninstall old versions
Older versions of Docker were called docker
or docker-engine
. If these are installed, uninstall them:
$ sudo apt-get remove docker docker-engine docker.io
The contents of /var/lib/docker/
, including images, containers, volumes, and networks, are preserved. The Docker CE package is now called docker-ce
.
You can install Docker CE in different ways, depending on your needs:
- Most users set up Docker’s repositories and install from them, for ease of installation and upgrade tasks. This is the recommended approach.
- Some users download the DEB package and install it manually and manage upgrades completely manually. This is useful in situations such as installing Docker on air-gapped systems with no access to the internet.
- In testing and development environments, some users choose to use automatedconvenience scripts to install Docker.
Install using the repository
a. Update the apt
package index:
$ sudo apt-get update
b. Install packages to allow apt
to use a repository over HTTPS:
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
c. Add Docker’s official GPG key:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Verify that you now have the key with the fingerprint
Use the following command to set up the stable repository. You always need the stablerepository
For x86_64 / amd64
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
INSTALL DOCKER CE
a. Update the apt
package index.
$ sudo apt-get update
b. Install the latest version of Docker CE, or go to the next step to install a specific version. Any existing installation of Docker is replaced.
$ sudo apt-get install docker-ce
c. install a specific version of Docker CE instead of always using the latest
$ sudo apt-get install docker-ce=<VERSION>
The Docker daemon starts automatically.
d. Verify that Docker CE is installed correctly by running the hello-world
image.
$ sudo docker run hello-world
Docker CE is installed and running. The docker
group is created but no users are added to it. You need to use sudo
to run Docker commands. Continue to Linux postinstall to allow non-privileged users to run Docker commands and for other optional configuration steps.
Reference : https://docs.docker.com/install/linux/docker-ce/ubuntu/
Install Docker Compose
Docker Compose relies on Docker Engine for any meaningful work, so make sure you have Docker Engine installed either locally or remote, depending on your setup.
a.Run this command to download the latest version of Docker Compose:
sudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
b. Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose
c.Test the installation.
$ docker-compose --version