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

Docker notes

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

Docker installation

CentOS 7 yum install docker

two。 Common command operation commands describe running docker run-- name container-name-d image-name:tag such as: docker run-- name myredis-d redis--name: custom container name-d: indicates that the background is running image-name: specify the name of the running image tag: list of versions of the image docker ps (view the running container); add-a You can view all containers stop docker stop container-name/container-id to stop the current operation of the specified container start docker start container-name/container-id start container delete docker rm container-id delete specified container port mapping-p 6379docker rm container-id 6379 such as: docker run-- name myredis-d-p 6379docker rm container-id docker rm container-id 6379: host port is mapped to the port inside the container docker logs container-name/container-id-tomcat installation tomcat runs

Docker run-it-- rm-p 8888 purl 8080-v $PWD/webapps:/usr/local/tomcat/webapps tomcat:latest

-it # is the abbreviation of-I and-t, which means to run the container in an interactive way, plus-d means to run in the background. Here, I use-it for screenshot output, or-d, and then use the "docker logs container name" command to output the log.

-- rm # automatically deletes a container when it is stopped

-p 8888 8080 # 80 is the port set for the tomcat in the container, which means that 8080 is mapped to host port 8888. If only-p 8080 is written, the container will randomly take the larger port number in the value 32768mm 61000 to map to port 8080.

-v # Map the usr/local/tomcat/webapps directory in tomcat to the webapps directory of the current host directory, and then update the jar package and throw it directly into the mapped host directory.

Tomcat:latest # Image name: tag tag

Backup and migration

The container is saved as a mirror

Docker commit pyg_nginx mynginx

Pyg_nginx is the container name

Mynginx is the new image name

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

Internet Technology

Wechat

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

12
Report