Install Docker in Linux

Reference: [original website, official tutorial]

1. Install Docker on RHEL/CentOS/Fedora

In brief, you can install Docker and start the service with the following commands:

sudo yum install docker-ce -y  # install docker package
sudo service  docker start  # start docker service
chkconfig docker on  # start-up automatically

FAQ

If your SELinux and BTRFS are on working, you may meet an error message as follow:

# systemctl status docker.service -l
...
SELinux is not supported with the BTRFS graph driver!
...

Modify /etc/sysconfig/docker as follow:

# Modify these options if you want to change the way the docker daemon runs
#OPTIONS='--selinux-enabled'
OPTIONS=''
...

Restart your docker service

Storage Issue:

Error message found in /var/log/upstart/docker.log

[graphdriver] using prior storage driver \"btrfs\"...

Just delete directory /var/lib/docker and restart the Docker service

2. Install Docker on Ubuntu/Debian

Generally, you can add the repository and execute

sudo apt-get install docker-ce

Both Debian Series and RHEL Series can be controlled by

sudo service docker start # stop, restart, ...

Once you started your service, you would find a socket file /var/run/docker.sock, and then you are able to execute your docker commands.