Install Docker Ce On Centos 7

CentOS 7 server, set up with a non-root user with sudo privileges (see Initial Server Setup on CentOS 7 for details) Docker installed with the instructions from Step 1 and Step 2 of How To Install and Use Docker on CentOS 7. Once these are in place, you will be ready to follow along. Step 1 — Installing Docker Compose. In order to get the. There are two methods for installing Docker on CentOS 7. One method involves installing it on an existing installation of the operating system. The other involves spinning up a server with a tool called Docker Machine that auto-installs Docker on it. In this tutorial, you’ll learn how to install and use it on an existing installation of CentOS 7.

  • 1Installing Docker Engine CE (Community Edition) on CentOS Linux 7

Install Docker Ce On Centos 7

Prerequisites

OS Requirements

To install Docker CE, the maintained version of CentOS Linux 7 is mandatory. Archived versions are not supported or tested. You must enable the centos-extras repository.

By default, the centos-extras repository is enabled. If it is disabled, you must re-enable it.

Uninstall Earlier Versions

Uninstall the earlier versions of Docker/Docker-engine along with associated dependencies using the following commands:

Install
$ sudo yum remove docker
docker-common
docker-selinux
docker-engine


Though YUM reports that the packages are not installed, the contents available in /var/lib/docker/ are saved, including images, containers, volumes and networks. The Docker CE package is now changed to Docker-ce. Previously, the package name was Docker.

Install kubernetes cluster with docker ce on centos 7

Install Docker CE

Install

You can install Docker CE using one of the following methods:

  • Install using the repository (most common method)

Install Using the Repository

  1. Set up the repository.
    Install required packages. yum-utils provides the yum-config-manager utility. The devicemapper storage driver requires the packages device-mapper-persistent-data and lvm2 for installation.
    $ sudo yum install -y yum-utils
    device-mapper-persistent-data
    lvm2
    Set up the stable repository by using the following command. You need a stable repository, even if you want to install builds from the edge or test repositories.
    $ sudo yum-config-manager
    --add-repo
    https://download.docker.com/linux/centos/docker-ce.repo
  2. Install Docker CE.
    1. Install the latest version of Docker CE.
      $ sudo yum install docker-ce
      If you are installing a package from a recently added repository for the first time, you will be prompted to accept the GPG key, and the key’s fingerprint will be displayed. Check if the fingerprint is correct. If the fingerprint is correct, accept the key. The fingerprint should match 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35.
      Docker is now installed, but not started. The Docker group is created. However, no users are added to the group.
      If you receive an error message stating that Parallel gzip (pigz) or container-selinux is not installed, you must install them. The following example provides commands on how to install pigz and container-selinux from the repository. These commands are used for installing pigz version 2.3.4-1.e17 and container-selinux version 2.21-1.el7, which are the latest versions. Please visit the repository URLS http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/p/ for pigz, and http://mirror.centos.org/centos/7/extras/x86_64/Packages/ for container-selinux to view the latest versions of both the packages.
      Command to install pigz
      yum install http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/p/pigz-2.3.4-1.el7.x86_64.rpm
      Command to install container-selinux
      yum install http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.21-1.el7.noarch.rpm
      Re-run the Docker installation after installing pigz and container-selinux.
    2. Install a specific version of Docker CE.
      yum list docker-ce --showduplicates sort -r
      docker-ce.x86_64 17.09.ce-1.el7.centos docker-ce-stable
      The contents of the list depend on the repositories that are enabled. These contents will be specific to your version of CentOS (indicated by the .el7 suffix on the version in the preceding example). Select a specific version to install. The second column is the version string. You can use the entire version string. You must include at least to the first hyphen. The third column is the repository name, which indicates which repository the package is from and by extension its stability level. To install a specific version, append the version string to the package name and separate them by a hyphen (-).
      The version string is the package name including the version up to the first hyphen. In the preceding example, the fully qualified package name is docker-ce-17.06.1.ce.
      $ sudo yum install <FULLY-QUALIFIED-PACKAGE-NAME>
  3. Start Docker.
    $ sudo systemctl start docker
  4. Run the hello-world image to ensure Docker is installed correctly.
    sudo docker run hello-world
    This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.

Install Manually Using the RPM Package

Install Docker Ce On Centos 7 64-bit

If you cannot use Docker’s repository to install Docker, you can download the .rpm file and install it manually. You will need to download a new file each time you want to upgrade Docker.

  1. Go to https://download.docker.com/linux/centos/7/x86_64/stable/Packages/ and download the .rpm file for the Docker version that you want to install.
    To install an edge package, change the word stable in the above URL to the word edge.
  2. Install Docker CE, changing the path below to the path where you downloaded the Docker package.
    $ sudo yum install /path/to/package.rpm
    Docker is now installed, but not started. The Docker group is created, but no users are added to the group.
  3. Start Docker.
    $ sudo systemctl start docker
  4. Run the hello-world image to ensure Docker is installed correctly.
    sudo docker run hello-world
Centos

Docker CE is now installed and running. You need to use sudo to run the Docker commands. For more information about the installation of Docker engine, refer to Docker documentation:https://docs.docker.com/engine/installation/linux/docker-ce/centos.

Install Using Automated Scripts

Docker provides scripts at https://get.docker.com/ and https://test.docker.com/ for installing edge and testing versions of Docker CE in development environments, quickly and non-interactively. The source code for these scripts is available at https://github.com/docker/docker-install. However, using these scripts is not recommended for production environments.