Created
May 10, 2023 02:29
-
-
Save myersguo/e279b057f6ae2ef7b8d10cdb6f1a9734 to your computer and use it in GitHub Desktop.
command list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Docker 的常用命令有: | |
1. docker images:列出本地主机上的镜像。示例: | |
bash | |
docker images | |
2. docker ps:列出运行中的容器。示例: | |
bash | |
docker ps | |
3. docker run:运行一个镜像。示例: | |
bash | |
docker run ubuntu echo "Hello world" | |
这将运行一个ubuntu镜像,并执行echo "Hello world"命令。 | |
4. docker start/stop/restart:启动/停止/重启一个容器。示例: | |
bash | |
docker start/stop/restart mycontainer | |
5. docker rm:删除一个或多个容器。示例: | |
bash | |
docker rm mycontainer | |
6. docker rmi:删除一个或多个镜像。示例: | |
bash | |
docker rmi ubuntu | |
7. docker exec:在运行的容器中执行命令。示例: | |
bash | |
docker exec mycontainer ls / | |
这将在mycontainer容器中执行ls /命令,列出根目录。 | |
8. docker commit:创建一个镜像。示例: | |
bash | |
docker commit mycontainer myubuntu | |
这将创建一个名为myubuntu的镜像,其中包含mycontainer容器的文件系统更改。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment