[FrontPage] [TitleIndex] [WordIndex

This is a read-only archived version of wiki.centos.org

Docker

Docker is an open-source engine that automates the deployment of any application as a lightweight, portable, self-sufficient container that will run virtually anywhere.

1. Installing Docker - CentOS-7

Docker (recompiled from RHEL 7) is included in the CentOS-Extras repository. You can simply run

$ sudo yum install docker

If you would like to use a (usually) more up to date version of docker, you can add this repo:

[virt7-container-common-candidate]
name=virt7-container-common-candidate
baseurl=https://cbs.centos.org/repos/virt7-container-common-candidate/x86_64/os/
enabled=1
gpgcheck=0

Note: You may need to disable CentOS-Extras to ensure you're fetching the package from the virt SIG repository.

$ sudo yum install docker --disablerepo=extras

Once docker is installed, you will need to start the service in order to use it.

$ sudo systemctl start docker

To start the docker service on boot:

$ sudo systemctl enable docker

2. Installing Docker - CentOS-6

ArtWork/WikiDesign/icon-admonition-alert.png

Installing Docker on CentOS-6 requires the use of the EPEL repository. Once you have enabled EPEL you may continue with the rest of the installation

To install docker on CentOS-6 install the docker-io package with the following command:

$ sudo yum install docker-io

Once docker is installed, you will need to start the service in order to use it.

$ sudo service docker start

To start the docker service on boot:

$ sudo chkconfig docker on

3. Using Docker

By default, docker must be run as root, or via sudo privileges.

ArtWork/WikiDesign/icon-admonition-alert.png

The docker packages intentionally omit the creation of the docker group, as it allows for trivial root escalation on the host. For more information, see this blog post by Dan Walsh.

To get the latest stable official CentOS image on Docker Hub:

$ sudo docker pull centos

This command only pulls the image tagged centos:latest, which always points to the latest stable CentOS release, currently CentOS 7 (centos:centos7). To pull any other version of the CentOS image, for example CentOS 6:

$ sudo docker pull centos:centos6

To verify the images have been fetched locally:

$ sudo docker images centos
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
centos              centos6             a30bc9f3097e        3 days ago          215.8 MB
centos              latest              dade6cb4530a        3 days ago          224 MB
centos              centos7             dade6cb4530a        3 days ago          224 MB

Running a basic cat command using docker:

$ sudo docker run centos:latest cat /etc/centos-release
CentOS Linux release 7.0.1406 (Core)

4. Docker Images

The Docker images are built using ami_creator with the kickstart files in the sig-cloud-instance-build project.

The finished builds can be found in the sig-cloud-images project, branched per version.

5. Further Reading

Visit Docker's official website for comprehensive information about the project including documentation. Source code is available on Docker's GitHub page.


2023-09-11 07:19