
Installing a container image from the Docker Registry
This recipe shows you how to procure a CentOS base for your development needs using Docker, a virtualization strategy based on the concept of containers. Each container wraps the target software in its own filesystem so that it can run regardless of the operating system on which it's installed. Developers like Docker especially because it helps provide consistency between development and deployment environments.
Getting ready
The recipe assumes that you have a system with Docker installed. If you don't, you can obtain the Docker installer from http://www.docker.com.
How to do it...
Follow these steps to install a CentOS container image from the Docker Registry:
- Open the Docker Toolbox terminal program.
- At the terminal's prompt, invoke the
docker pull
command to retrieve a CentOS 7 container:docker pull centos:7
- After the container has been downloaded, you can launch an interactive shell with
docker run
:docker run -i -t centos:7 /bin/bash
How it works...
This recipe retrieves the official CentOS container from the Docker Registry using the docker pull
command. By providing the version tag (:7
), we can make sure we retrieved CentOS 7 as opposed to an earlier (or perhaps newer) version.
Alternatively, Kitematic is the graphical program which lets us search for and retrieve containers from the registry. Simply launch Kitematic and enter CentOS as the search term in the search box. Then, look for the official CentOS repository in the results list.
The default version retrieved by Kitematic is the latest. To specifically select CentOS 7 or a maintenance release, click on the entry's ellipsis button. Set the desired tag and then click on the Create button:

Kitematic displays the results of searching for CentOS
See also
Refer to the following resources for more information about working with Docker:
- Docker home page (http://www.docker.com)
- Understanding the Docker architecture (https://docs.docker.com/engine/understanding-docker)
- The official CentOS Docker hub (https://hub.docker.com/_/centos)