How to Install Docker CE on Ubuntu / Install Docker CE on Debian / Install Docker on Fedora / Install Docker on Arch Linux, and Installing Docker CE on CentOS guide is provided here. Note that older versions of docker ( docker and docker-engine), are no longer supported. At the moment, docker CE ( Community Edition) and docker EE ( Enterprise edition) are available.
Also check:
How To Install Latest Docker Compose on Linux
Install and Configure Docker Registry on CentOS 7
How to Setup Docker Private Registry on Ubuntu 18.04 / Ubuntu 16.04 with Letsencrypt SSL
What’s Docker?
Docker is a container runtime engine which allows you to package an application with all of its dependencies into a standardized unit for software development.
Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in.
Why Docker?
Following are key things to note about docker:
- Docker containers are based on open standards allowing containers to run on all major Linux distributions and Microsoft operating systems with support for every infrastructure.
- Docker gives developers the freedom to define environments, and create and deploy apps faster and easier, and flexibility for IT ops to quickly respond to change.
- Containers isolate applications from each other and the underlying infrastructure while providing an added layer of protection for the application.
- Each virtual machine includes the application, the necessary binaries and libraries and an entire guest operating system – all of which may be tens of GBs in size.
- Containers include the application and all of its dependencies, but share the kernel with other containers. They run as an isolated process in userspace on the host operating system. They’re also not tied to any specific infrastructure – Docker containers run on any computer, on any infrastructure, and in any cloud.
- Docker gives you choice without complexity, from a laptop to a team, to private infrastructure and public cloud providers.
Also relevant is Ctop – Top command for container metrics
Installing Docker CE
Here we’ll cover installation of Docker CE on Ubuntu, Debian, Fedora, and CentOS and Arch Linux distributions.
Install Docker CE on Ubuntu
Uninstall Old version of Docker. Old versions of docker had the name docker or docker-engine. If you have it installed, first uninstall it.
sudo apt-get remove docker docker-engine docker.io
The Docker CE package is now called docker-ce.
Update the apt
package index:
sudo apt-get update
Install packages to allow apt to use a repository over HTTPS:
sudo apt-get install apt-transport-https \ ca-certificates \ curl \ software-properties-common
Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Add stable repository:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Install docker ce:
sudo apt-get update sudo apt-get install docker-ce
If you would like to use Docker as a non-root user, you should now consider adding your user to the “docker” group with something like:
sudo usermod -aG docker your-user
Run the command below to see a version of docker installed.
$ docker version Client: Version: 18.09.3 API version: 1.39 Go version: go1.10.8 Git commit: 774a1f4 Built: Thu Feb 28 06:53:11 2019 OS/Arch: linux/amd64 Experimental: false Server: Docker Engine - Community Engine: Version: 18.09.3 API version: 1.39 (minimum version 1.12) Go version: go1.10.8 Git commit: 774a1f4 Built: Thu Feb 28 05:59:55 2019 OS/Arch: linux/amd64 Experimental: false
To get more details about docker, run:
$ docker info
Install Docker CE on Debian
Update the apt package index:
sudo apt-get update
Install packages to allow apt to use a repository over HTTPS:
sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
Set up the stable repository:
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
Install Docker:
sudo apt-get update sudo apt-get -y install docker-ce docker-ce-cli containerd.io
Uninstall Docker CE on Debian
If you would like to uninstall Docker CE, use the commands:
sudo apt-get remove docker docker-engine docker.io containerd runc
Clean images, containers, and volumes:
sudo rm -rf /var/lib/docker
Install Docker CE on Fedora:
Uninstall Older versions of Docker:
sudo dnf remove docker docker-common docker-selinux docker-engine-selinux docker-engine
Configure Docker repository:
sudo dnf -y install dnf-plugins-core sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
Install Docker CE:
sudo dnf install docker-ce docker-ce-cli containerd.io
Start and enable docker service:
sudo systemctl start docker && sudo systemctl enable docker
Install Docker CE on CentOS:
Uninstall old versions:
sudo yum remove docker docker-common docker-selinux docker-engine
Install Prereqs:
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Setup stable repo:
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Install Docker CE:
sudo yum -y install docker-ce docker-ce-cli containerd.io
If you get dependency errors, the run:
sudo yum install -y --setopt=obsoletes=0 docker-ce docker-ce-selinux
Start and enable docker service:
sudo systemctl start docker && sudo systemctl enable docker
Install Docker CE on Arch:
Install yay:
yay – Best AUR Helper for Arch Linux / Manjaro
Install Docker CE using pacaur:
yay -S --noconfirm --needed docker
Confirm that it was successfully installed:
$ sudo docker version Client: Version: 18.09.2-ce API version: 1.39 Go version: go1.11.5 Git commit: 62479626f2 Built: Mon Feb 11 23:58:17 2019 OS/Arch: linux/amd64 Experimental: false Server: Engine: Version: 18.09.2-ce API version: 1.39 (minimum version 1.12) Go version: go1.11.5 Git commit: 62479626f2 Built: Mon Feb 11 23:55:58 2019 OS/Arch: linux/amd64 Experimental: false
After installing Docker, you may be interested in:
Install Docker UI manager – Portainer
Ctop – Top command for container metrics
How to Setup Docker Private Registry on Ubuntu 18.04 / Ubuntu 16.04 with Letsencrypt
Install and Configure Docker Registry on CentOS 7
Install Docker and Docker Compose on RHEL 8 / CentOS 8
How to setup 3 node Kubernetes Cluster on Ubuntu 18.04 with Weave Net CNI
Tags
- How to get docker running on Ubuntu 18.04 and Ubuntu 16.04
- Latest docker installation on Debian and Ubuntu
- Install the latest docker on Kali Linux
- Docker definitive installation for Debian derivatives
- How to get started with docker on Ubuntu and Debian