1. Installation of Docker under CentOS8 curl https://download.docker.com/linux/centos/docker-ce.repo -o /etc/yum.repos.d/docker-ce.repo yum install -y https://download.docker.com/linux/fedora/30/x86_64/stable/Packages/containerd.io-1.2.6-3.3.fc30.x86_64.rpm yum install -y docker-ce 2. Starting and stopping Docker under CentOS8 Start command systemctl start docker service docker start Shutdown command systemctl stop docker service docker stop View Docker status docker info 3. Image Accelerator Configuration 1. Visit Alibaba Cloud https://www.aliyun.com/ 2. Configure the mirror acceleration address Enter the console View the configured mirror acceleration address docker info See the Registry Mirrors: section. 4. Basic Operations of Docker Basic Operation Advanced Operations Use of the orchestration tool docker-compose1 Use of the orchestration tool docker-compose2 5. Other Techniques 1. Kill the docker container docker kill container ID or name 2. View Docker container logs docker logs -f -t container_name 3. Check which processes are running in the docker container docker top container_name 4. Run the docker container without automatically exiting and then entering the container docker run -d -it 63bd2b510f17 /bin/bash Or docker run -id d70eaf7277ea # Sometimes it doesn't work docker exec -it 03d80e28c244 /bin/bash Note that /bin/bash should be placed at the end. 5. View the container configuration information docker inspect 03d80e28c244 6. Copy files/directories between container and host docker cp --help Usage: docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|- docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH Copy files/folders between a container and the local filesystem Use '-' as the source to read a tar archive from stdin and extract it to a directory destination in a container. Use '-' as the destination to stream a tar archive of a container source to stdout. Options: -a, --archive Archive mode (copy all uid/gid information) -L, --follow-link Always follow symbol link in SRC_PATH 6. One-click packaging of docker images in IDEA 1. Modify Docker service configuration vim /usr/lib/systemd/system/docker.service Found the following Add the following content at the end of the red mark in the above picture -H unix:///var/run/docker.sock -H 0.0.0.0:2375 # -H unix:///var/run/docker.sock : Start an external host service and use the docker.sock file for management. # -H 0.0.0.0:2375 : What client IPs are allowed to access the current service, and what is the port number exposed by the current service. 2375 is a custom port. systemctl daemon-reload systemctl restart docker 2. Introduce corresponding plug-ins in POM file <build> <plugins> <plugin> <groupId>com.spotify</groupId> <artifactId>docker-maven-plugin</artifactId> <version>1.2.2</version> <configuration> <imageName>projects/eureka:1.0</imageName> <!--Specify the image name warehouse/image name: label--> <baseImage>openjdk:latest</baseImage> <!--Specify the base image--> <dockerHost>http://192.168.74.131:2375</dockerHost> <!-- Specify the service deployment server warehouse address--> <entryPoint>["java","-jar","/${project.build.finalName}.jar"]</entryPoint> <!-- Command executed when the container is started--> <exposes> <expose>8761</expose><!-- Publish port --> </exposes> <resources> <resource> <targetPath>/</targetPath> <!-- Specify the directory path to be copied, here is the current directory--> <directory>${project.build.directory}</directory> <!-- Specify the root directory to be copied, here is the target directory --> <include>${project.build.finalName}.jar</include> <!-- Specify the file to be copied, here refers to the final generated jar package --> </resource> </resources> </configuration> </plugin> </plugins> </build> If it prompts that the Maven plugin cannot be imported, you can modify the Maven configuration file conf/settings.xml and add the following content: <pluginGroups> <pluginGroup>com.spotify</pluginGroup> </pluginGroups> Then Note that when importing dependencies, you must first import the dependent packages - do not configure the configuration tag first. 3. Add IDEA startup configuration or docker run -d -p 8761:8761 --name eureka01 image_name docker logs -f container_name 7. Push the Docker image of the local server to the Alibaba Cloud private warehouse 1. Create an Alibaba Cloud image repository 2. Push your image to the image repository Just follow the operation guide. 8. Create a local image repository 1. Create a new local warehouse The local warehouse is also a docker container docker pull registry vim /usr/lib/systemd/system/docker.service ======================================================================== Find the Service node and add a new parameter at the end of the ExecStart attribute with the value: --insecure-registry 192.168.74.131:5000 vim /etc/docker/daemon.json ========================================================================= Add the following configuration at the end: { "insecure-registries":["192.168.74.131:5000"] } systemctl daemon-reload systemctl restart docker docker run -p 5000:5000 -v /opt/registry:/var/lib/registry --name registry -d registry 192.168.74.131 refers to the local business server address. 2. Browse to view the local warehouse http://ip:5000/v2 3. Push the image # Rename the image docker tag [ImageId] ip:5000/[image name]:[image version number] docker push ip:5000/[image name]:[image version number] View push results in the browser 4. Pull the image docker pull ip:5000/[image name]:[image version number] This is the end of this article about the use of Docker under CentOS8. For more information about the use of Docker under CentOS8, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: MySQL master-slave replication principle and points to note
>>: Solution to Vue's inability to watch array changes
1. Check the maximum number of open files in the ...
I wrote a simple UDP server and client example be...
Since Zabbix version 3.0, it has supported encryp...
This article mainly introduces the example analys...
Table of contents introduce Example Summarize int...
This article shares the specific steps for config...
This article uses an example to describe how to a...
1 CSS style without semicolon ";" 2 Tags...
Here is a Vue single sign-on demo for your refere...
Table of contents Enter the topic mysql add, dele...
1.1. Download: Download the zip package from the ...
The mysql connection must first be initialized th...
Table of contents SQL execution order bin log Wha...
Problem Description I created three virtual machi...
Table of contents 1. Basic Concepts ACID 3.AutoCo...