Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed explanation of Docker-based service deployment process

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This summary involves Docker-io, the installation of Docker-ce, the creation of CentOS7 images, the construction of Docker private repositories, the pulling of private images from CentOS7 private repositories in CentOS6.7 environment, the operation of Docker containers, and the compatibility of CentOS6.5 and CentOS7 when running together.

The basic components of Docker and the operation flow of DevOps

The DockerImage:Docker image is a read-only template that runs the container.

The DockerContainer:Docker container is a standardized unit for running applications.

The DockerRegistry:Docker registration server is used to store images.

The DockerEngine:Docker engine is used to create, run, and manage containers on the host.

II. Installation and configuration of Docker

Due to the slow download of Docker foreign sites or unable to download normally, it needs to be updated to a foreign source before rapid installation and configuration. CentOS6.5 install docker-io,CnetOS7 install docker-ce

# create docker-related directories mkdir-p / data/docker# install docker run the necessary tools sudo yum install-y yum-utilsdevice-mapper-persistent-data lvm2 crontabs# add docker download repository, use Aliyun warehouse to download Sudo yum-config-manager is too slow to download from foreign sites-add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.reposudo yum makecache fast# installs docker and detects docker installation and operation sudo yum- y install docker-cedocker versionsystemctl enable docker.servicesystemctl start docker.service# configuration dockersudo mkdir-p / etc/dockersudo tee / etc/docker/daemon.json $logfile # # addDOCKER_OPTS $exec-d $DOCKER_OPTS & > $logfile & Pidshellop! Touch $lockfile # waitup to 10 seconds for the pidfile to exist. See # https://github.com/docker/docker/issues/5359 tries=0 while [!-f $pidfile-a $tries-lt 10]; do sleep 1 tries=$ ((tries + 1)) done success echo else failure echo printf "$pidfile still exists...\ n" exit 7 fi}

⑶ restarts docker and verifies pull functionality

[root@123] # service docker restart

⑷ other methods

Not so much trouble, directly modify the startup item, the principle and results are the same, and then restart dockerdaemon

[root@123] # vi / etc/init.d/docker## find exec and directly add-- insecure-registryip: portprog= "docker" exec= "/ usr/bin/$prog-- insecure-registryip:port" pidfile= "/ var/run/$prog.pid" lockfile= "/ var/lock/subsys/$prog" logfile= "/ var/log/$prog"

2. Docker CE version

Check to see if there is a daemon.json file in the / etc/docker directory, and create it if not, or simply modify it in: wq after vi/etc/docker/daemon.json modification.

[root@123] # vi / etc/docker/daemon.json## add {"registry-mirrors": ["https://registry.docker-cn.com"]," insecure-registries ": [" ip:port "," ip:port "]}

Restart the docker service after adding

Service docker restart

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report