In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the creation of the docker container and what the common operation commands are related knowledge, the content is detailed and easy to understand, the operation is simple and fast, with a certain reference value, I believe that after reading this docker container creation and common operation commands what the article will have a harvest, let's take a look.
Introduction to docker Container
A container is an example of an external service.
Necessary conditions for container startup: at least one process in the container is running in the foreground
1 、 Create container # format docker run [parameter] [image name] [run container startup command] # parameter-d: run a container docker run-d [image name] [cmd]-- name: specify the name of the container docker run-d-- name [container name] Call] [cmd]-p: specify port mapping docker run-d-p host port: container port [image name] [cmd]-P: random port mapping docker run-d-P [image name] [cmd]-I: open standard output -t: create a pseudo terminal docker run-it [image name] [cmd]-v: mount the directory to the container docker run-v host directory: container directory [image name] [cmd]-- rm: delete docker run-- rm immediately at the end of the container life cycle Image name] [cmd]-e: create an environment variable in the container, docker run-e NAME=Centos-d [image name] [cmd]-- link: connect to the previous container Implement network interconnection docker run-- link the name of the connected container: connection alias [image name] [cmd]-h: set the container hostname docker run-h "image name" [image name] [cmd] # docker run run process 1, check whether the specified image is used locally, if not, go to the corresponding warehouse to download the image 2 and start the container If you specify a command, use the specified command, if not, use the default command 3, return the container ID2, view the local container list # format docker ps [parameters] docker ps # View the list of containers currently running on the system # Parameter-a: view all containers in the system. -Q: displays only the ID of the container
3. Stop and start a container # stop docker stop [container ID | name] # start (the container must be a container that already exists on the system) docker start [container ID | name] 4. Delete container # format docker rm [container name | ID] # Parameter-f: force deletion of docker rm-f [container name | ID] # empty container docker rm $(container-a-Q) 5, view container content # format docker inspect [container name | ID] # how to monitor the running status of docker? Docker inspect-f'{{.State.Running}} 'nginx6, copy command 1, copy to the docker cp inside the container [host host file path] Container ID: path inside the container 2, copy to the docker cp container outside the container ID: path inside the container [host host file path] 7, enter container # there are four general ways to enter the container, Exec: execute a command inside the container outward (officially recommended) docker exec [parameter] [container name | ID] [cmd] docker exec-it 685e1 bash2, attach: the command to enter the container provided in the early docker (disadvantage: when it ends Docker attach [container ID | name] 3. Nsenter: establish a pipe connection to the container master ID nsenter-- target $(docker inspect-f {{.State.Pid}} 30d369d70bcd)-- mount-- uts-- ipc-- net-- pid4, ssh: this is the end of the article on "docker container creation and common operation commands through ssh connection". Thank you for reading! I believe you all have a certain understanding of "what is the creation of docker containers and what common operation commands are". If you want to learn more, you are welcome to follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.