In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail the usage examples of the basic Docker commands for you. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
I. system-related commands:
1.1 View the version information of docker: docker version
1.2 View docker system information: docker info
2. Commands related to image:
2.1search for images: docker search image_name
Download Image: docker pull image_name
2.3 View all local images: docker images
Among them, the parameters that can be used are:-a-- an is used to specify whether all mirrors are displayed.
2.4 Delete an existing image: docker rmi image_name/ id
2.5 View the historical information of the image: docker history image_name
2.6 Export the image and save it as a tar package:
$docker save image_name-o file_path$docker save image_name > / home/save.tar
2.7 load an image in tar package format
$docker load-I file_path$docker load < / home/save.tar
2.8Publishing docker images
$docker push new_image_name
2.9 build a container based on Dockerfile
$docker build-t image_name Dockerfile_path
III. Container management
3.1Interactive launch container and enter: docker run-I-t image_name / bin/bash
Install a new program in the container: docker run image_name apt-get install-y app_name
(note: when executing the apt-get command, take the-y parameter with you. If the-y parameter is not specified, the apt-get command enters interactive mode and requires the user to enter a command for confirmation, but there is no way to respond to this interaction in the docker environment. After the apt-get command is executed, the container stops, but the changes to the container are not lost.
)
3.3 View all existing containers:
Docker ps # displays running containers docker ps-a # shows all containers, including stopped containers docker ps-l #-l shows the most recently used container
3.4 Save the container as a mirror: docker commit ID new_image_name
Delete all containers docker rm `containers-a-q`
3.6 Delete a single container docker rm Name/ID
3.7 stop, start, kill a container
$docker stop Name/ID $docker start Name/ID $docker kill Name/ID
3.8 read the container log:
$docker logs Name/ID
3.9 list the files or directories that have been changed in a container
$docker diff Name/ID
3.10 displays the process information in a running container
3.11 copy files / directories from the container to a local path
$docker cp Name:/container_path to_path $docker cp ID:/container_path to_path
3.12 restart a running container
3.13 attach to a running container
$docker attach ID
3.14 detach from a container
CTRL-C
This is the end of the article on "examples of the usage of basic Docker commands". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
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.