Install Docker on CentOS

Docker’s CentOS-specific installation instructions are always going to be the most up to date for the latest version of Docker. However, the following recommendations and instructions should make it easier to manage the Docker installation over time and mitigate several known issues with various other configurations.


In addition to the general Docker requirements and recommendations for DC/OS, the following CentOS-specific recommendations will improve your DC/OS experience.

  • Use Docker’s yum repository to install Docker on CentOS. The yum repository makes it easy to upgrade and automatically manages dependency installation.

  • Prefer the OverlayFS storage driver. OverlayFS avoids known issues with devicemapper in loop-lvm mode and allows containers to use docker-in-docker, if they want.

  • Use CentOS 7.2 or greater. OverlayFS support was improved in 7.2 to fix a bug with XFS.

  • Format node storage as XFS with the ftype=1 option. As of CentOS 7.2, “only XFS is currently supported for use as a lower layer file system”.

    mkfs -t xfs -n ftype=1 /dev/sdc1


The following instructions demonstrate how to use Docker with OverlayFS on CentOS 7.

  1. Upgrade CentOS to 7.3:

    sudo yum upgrade --assumeyes --tolerant
    sudo yum update --assumeyes
  2. Verify that the kernel is at least 3.10:

    uname -r
  3. Enable OverlayFS:

    sudo tee /etc/modules-load.d/overlay.conf <<-'EOF'
  4. Reboot to reload kernel modules:

  5. Verify that OverlayFS is enabled:

    lsmod | grep overlay
  6. Configure yum to use the Docker yum repo:

    sudo tee /etc/yum.repos.d/docker.repo <<-'EOF'
    name=Docker Repository
  7. Configure systemd to run the Docker Daemon with OverlayFS:

    sudo mkdir -p /etc/systemd/system/docker.service.d && sudo tee /etc/systemd/system/docker.service.d/override.conf <<- EOF
    ExecStart=/usr/bin/dockerd --storage-driver=overlay
  8. Install the Docker engine, daemon, and service.

    sudo yum install -y docker-engine-1.13.1 docker-engine-selinux-1.13.1
    sudo systemctl start docker
    sudo systemctl enable docker

    When the process completes, you should see:

    Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/docker.service.
  9. Test that Docker is properly installed:

    sudo docker ps

For more generic Docker requirements, see System Requirements: Docker.