Installing Docker on CentOS/RHEL

Requirements, recommendations and procedures for installing Docker CE on CentOS/RHEL

Requirements and Recommendations

These directions cover the installation of Docker CE on CentOS/RHEL. Before installing Docker on CentOS/RHEL, review the general requirements and recommendations for running Docker on DC/OS.

  • OverlayFS is now the default in Docker CE. There is no longer a need to specify or configure the overlay driver. OverlayFS avoids known issues with devicemapper in loop-lvm mode and allows containers to use docker-in-docker, if they want.

  • These instructions are specific to CentOS/RHEL 7.4. Other versions of CentOS/RHEL 7 should work but might require minor modifications to the commands.

  • You must format node storage as XFS with the ftype=1 option. As of CentOS/RHEL 7.2, only XFS is currently supported for use as a lower layer file system. See the RHEL release notes.

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

Note: In modern versions of Centos and RHEL, ftype=1 is the default. The xfs_info utility can be used to verify that ftype=1.

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

Installation

Follow the Docker CentOS-specific installation instructions.

RHEL-only requirements

You must register with the subcription-manager to enable additional repos.

  1. Subscribe the RHEL system in subscription-manager and add the repos

    sudo subscription-manager register --username <RHEL-SUBSCRIPTION-USERNAME> --password ******** --auto-attach
    
    sudo subscription-manager repos --enable=rhel-7-server-rpms
    sudo subscription-manager repos --enable=rhel-7-server-extras-rpms
    sudo subscription-manager repos --enable=rhel-7-server-optional-rpms
    

Example: Installing Docker with OverlayFS on CentOS/RedHat

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

  1. Configure OS for overlay storage:

    echo 'overlay' | sudo tee -a /etc/modules-load.d/overlay.conf
    sudo modprobe overlay
    
  2. Run yum update:

    sudo yum update --exclude=docker-engine,docker-engine-selinux,centos-release* --assumeyes --tolerant
    
  3. Un-install old versions of Docker (if present):

    sudo yum remove docker \
                  docker-common \
                  docker-selinux \
                  docker-engine
    
  4. Set up Docker CE repository:

    sudo yum-config-manager \
        --add-repo \
        https://download.docker.com/linux/centos/docker-ce.repo
    
  5. Show versions of Docker CE.

    sudo yum list docker-ce --showduplicates | sort -r
    

The remainder of these instructions assume that you have installed the latest version.

  1. Install Docker CE:

    sudo yum install docker-ce
    
  2. Start Docker:

    sudo systemctl start docker
    sudo systemctl enable docker
    
  3. Test Docker with hello-world app:

    sudo docker run hello-world
    
  4. Verify that Docker is using the overlay driver:

    sudo docker info | grep Storage
    

To continue setting up DC/OS, see the Installation documentation.