Requirements and Recommendations

Before installing Docker on CentOS, review the general requirements and recommendations for running Docker on DC/OS and the following CentOS-specific recommendations:

  • Use the Docker 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
    

Installation Procedure

Follow the Docker CentOS-specific installation instructions.

Example: Installing Docker with OverlayFS

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

  1. Upgrade CentOS to 7.4:

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

    uname -r
    3.10.0-327.10.1.el7.x86_64
    
  3. Enable OverlayFS:

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

    reboot
    
  5. Verify that OverlayFS is enabled:

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

    sudo tee /etc/yum.repos.d/docker.repo <<-'EOF'
    [dockerrepo]
    name=Docker Repository
    baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
    enabled=1
    gpgcheck=1
    gpgkey=https://yum.dockerproject.org/gpg
    EOF
    
  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
    [Service]
    ExecStart=
    ExecStart=/usr/bin/dockerd --storage-driver=overlay
    EOF
    
  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:

    Complete!
    Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service 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.