Docker is an application that makes it simple and easy to run application processes in a container, which are like virtual machines, only more portable, more resource-friendly, and more dependent on the host operating system.
An image is a lightweight, stand-alone, executable package that includes everything needed to run a piece of software, including the code, a runtime, libraries, environment variables, and config files.
A docker/container is a runtime instance of an image. It runs completely isolated from the host environment by default and run apps natively on the host machine’s kernel. The container image is an executable which never need to be installed on the host system. Hence, it contains all its dependencies and there is no configuration entanglement so you can run a containerized app anywhere.
I was not impressed with the install instructions given on Docker website for linux command line installation.
Here is the simple set of instructions that I followed to install Docker on my Centos 7 and got it up and running in no time!
System Requirements: 64-bit Centos 7
Run this command to add the official Docker repository, download the latest version of Docker, and install it:
curl -fsSL https://get.docker.com/ | sh
snippet of output
# Executing docker install script, commit: fc04d2c
+ sudo -E sh -c 'yum install -y -q yum-utils'
Package yum-utils-1.1.31-42.el7.noarch already installed and latest version
+ sudo -E sh -c 'yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo'
Loaded plugins: fastestmirror
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
+ '[' edge '!=' stable ']'
+ sudo -E sh -c 'yum-config-manager --enable docker-ce-edge'
Loaded plugins: fastestmirror
After installation has completed, start the Docker daemon:
sudo systemctl start docker
Verify that it’s running:
sudo systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2018-03-06 15:36:00 PST; 6s ago
Main PID: 2513 (dockerd)
└─2517 docker-containerd --config /var/run/docker/containerd/containerd.toml
Mar 06 15:35:59 madhuj dockerd: time="2018-03-06T15:35:59-08:00" level=info msg=serving... address="/var/run/docker/containerd/docker-containerd.sock" module="containerd/grpc"
Mar 06 15:35:59 madhuj dockerd: time="2018-03-06T15:35:59-08:00" level=info msg="containerd successfully booted in 0.015250s" module=containerd
Mar 06 15:36:00 madhuj dockerd: time="2018-03-06T15:36:00.034436419-08:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
Mar 06 15:36:00 madhuj dockerd: time="2018-03-06T15:36:00.036682427-08:00" level=info msg="Loading containers: start."
Mar 06 15:36:00 madhuj dockerd: time="2018-03-06T15:36:00.373054005-08:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon...d IP address"
Mar 06 15:36:00 madhuj dockerd: time="2018-03-06T15:36:00.624304025-08:00" level=info msg="Loading containers: done."
Lastly, make sure it starts at every server reboot:
sudo systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
You can try logging in with your docker credentials
$ sudo docker login
Try running hello-world docker image:
$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pull complete
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.