Simple docker ce installation and simple configuration on centos7
I. Environmental choices
Containers require administrative tools, runtime, and operating systems, and our choices are as follows:
Docker Engine
Docker is the most popular and widely used.
runtime - runc
Docker's default runtime
operating system
centos7
Second, install Docker
Because the installation process requires internet access, the virtual machine must be able to access the internet.
Docker supports almost all Linux distributions, as well as Mac and Windows. The installation method of each operating system can be visited at docs.docker.com/engine/installation/
Docker is divided into an open-source CE (Community Edition) version and a fee-based EE (Enterprise Edition) version.
2.1 Install using repository
Before installing Docker CE for the first time on a new host, you need to set up the Docker repository. After that, you can install and update Docker from the repository.
settings repository
Install the required packages. Yum-utils provides yum-config-manager utility, and device-mapper-persistent-data and lvm2 by requiring devicmapper storage drivers.
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
2 Use the following command to set up a stable repository.
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo2.2 Install DOCKER CE
Install the latest versions of Docker CE and containerd, or go to the next step to install specific versions:
sudo yum install docker-ce docker-ce-cli containerd.io
To install a specific version of Docker CE, list the available versions in repo, then select and install:
One. Lists and sorts the versions available in your repository. This example sorts the results by version number, from highest to lowest.
yum list docker-ce --showduplicates | sort -r
Install specific docker-ce
sudo yum install docker-ce- docker-ce-cli- containerd.io
For example, yum install doceker-ce-18.06.0-ce-3.el7 containerd.io
2.3 Start docker service
sudo systemctl start dockersudo systemctl enable docker
Verify Docker CE is installed correctly by running the hello-world image.
sudo docker run hello-world
This command downloads the test image and runs it in the container. When the container runs, it prints an informational message and exits.
III. Operating container
Run the container as follows
docker run -d -p 80:80 httpd
The process is as follows:
1) Download httpd image from Docker Hub, Apache HTTP Server has been installed in the image
2)Start httpd container and map port 80 of container to port 80 of host
If you can see the following, the container is normal
use the accelerator
Since docker hub's server is abroad, downloading images will be slower. You can use DaoCloud to provide us with free domestic image services.
1) Register a user at daocloud.io for free
2) Login Click on the top menu "Accelerator"
Configure the accelerator as above and restart the docker service