Docker docker environment construction & docker compose environment construction


1、 Docker environment construction

1. Docker installation

#Update Yum source
yum update -y
#Install docker
yum list installed | grep docker
yum install -y yum-utils
yum-config-manager --add-repo
yum makecache fast
yum install -y docker-ce-18.09.6-3.el7 docker-ce-cli-18.09.6-3.el7
systemctl start docker
Systemctl enable docker. // startup starts automatically

2. Docker upgrade
Docker upgrade image download address

#Download docker-ce-xxx
#Upgrade docker CE
yum -y upgrade ./docker-ce-18.09.6-3.el7.x86_64.rpm
#Install docker CE
yum install ./docker-ce-18.09.6-3.el7.x86_64.rpm

3. Docker removal

yum list installed | grep docker
yum -y remove docker-engine.x86_64
rm -rf /var/lib/docker

2、 Construction of docker compose environment

1. Install docker compose

curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
##An error may be reported. Curl: (35) peer reports incompatible or unsupported protocol version. Execute Yum update - y NSS curl libcurl
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version

2. Docker compose startup

#Start application
docker-compose up -d
docker-compose ps
#Add application
docker-compose create
docker-compse logs -f <server-name>

3、 Docker container management

1. Create and push images

#Commit mirror to local according to container
docker commit -m "add image" -a 'tt' 37bb image-name
#Click tag according to the generated image
docker tag image-name
#If the image warehouse needs to log in, log in
docker login 
#Push image
docker push

2. About configuring the image warehouse

#Error response from daemon: get \_ ping: http: server gave HTTP response to HTTPS client
#1. View the imported image warehouse address
cat /etc/docker/daemon.json
#1. Add image warehouse address
echo '{ "insecure-registries":["",""] }' > /etc/docker/daemon.json
#2. Restart docker
systemctl restart docker

3. About docker network

#Bridge network created by default when network driver is not specified
docker network create default_network
#View network internal information
docker network inspect default_network
#List all lists of networks
docker network  ls
#Remove the specified network
docker network rm default_network

4、 Docker common commands

Recommended Today

Win10 system comes with screenshot tool

How to use the screenshot function of win10 system The screenshot function is often used in the process of daily computer use. In fact, win10 system itself has the screenshot function. The following describes how to use the screenshot function of win10 system. Tools / raw materials  Computer system: Windows 10 professional edition Method / […]