Stick
March 2, 2018 (Last edit January 17, 2019)

Last updated 2018-03-03

Install Docker Community Edition

I am working on a clean CentOS 7 VM clone, so I don’t need to remove old versions, but I do need to set a new hostname. * echo docker-centos7.stma | sudo tee /etc/hostname * sudo hostname -F /etc/hostname

From the Docker Docs. 1. sudo curl -L https://download.docker.com/linux/centos/docker-ce.repo -o /etc/yum.repos.d/docker-ce.repo 1. sudo yum update 1. sudo yum install device-mapper-persistent-data docker-ce lvm2 1. sudo systemctl enable docker

Note that sudo systemctl is aliased to sctl in my bashrc.

Generate the initial directories

  1. sudo systemctl start docker
  2. sudo systemctl stop docker

Configure the OverlayFS storage driver

From the Docker Docs.

  1. sudo vim /etc/docker/daemon.json
{
  "storage-driver": "overlay2",
  "storage-opts": ["overlay2.override_kernel_check=true"],
  ...
}

In Arch Linux

The Arch Wiki has a different method of setting the options, using a Drop-in Snippet. * sudo systemctl edit docker

[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -s overlay2

Set up user privileges

Don’t do this for untrusted users. As detailed in the Docker Docs, it’s equivalent to giving a user full root access.

  1. sudo usermod -aG docker stick

Set up remote access

  1. sudo vim /etc/docker/daemon.json
{
  ...
  "hosts": ["tcp://0.0.0.0:2375"],
  ...
}

The Docker Docs mention RHEL and CentOS overriding the hosts array, but I found that was not true in current CentOS 7. However, I did find that including "fd://" in the "hosts" array causes docker to fail on startup.

In Arch Linux

The Arch Wiki has a different method of setting the options, using a Drop-in Snippet. * sudo systemctl edit docker

[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock -s overlay2 

Try it out

docker run hello-world

Optional: Take a snapshot

  1. history -c
  2. Close -> ACPI Shutdown
  3. Snapshots -> Take