2.查看docker安装详细信息
3.测试docker是否安装成功
## 出现如下信息为安装成功
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pull complete
Digest: sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
...
4.查看所有已安装的镜像
5.删除一个镜像
docker rmi [image ID | Repository] |
6.查看运行的容器信息
docker ps [-a] # 加上-a显示所有的容器包括未运行的 |
7.运行一个镜像
docker run --name [container name] -t -i [image ID | Repository:TAG] /bin/bash |
*-t 选项让Docker分配一个伪终端(pseudo-tty)并绑定到容器的标准输入上, -i 则让容器的标准输入保持打开
*这里若TAG是latest可以不指定
8. 停止、启动、恢复容器
docker stop [container name | container ID]
docker start [container name | container ID]
docker attach [container name | container ID] # 恢复容器到命名行,输完指令需要按一次enter |
8.挂载本地目录到镜像
docker run -v [local folder path]:[container mounted path] --name [container name] -t -i [image ID | repository name] : TAG] /bin/bash |
示例:
docker run -v /home/hz/caffe:/workspace -t -i --name caffe bvlc/caffe:gpu /bin/bash
9.容器重命名
docker rename [original name] [new name] |
10.查看容器详细信息
docker inspect [container name | container id] |
11.将本地文件上传到容器内
docker cp [local file path] [container id]:[container file path] |
Docker常用命令总结
原文:https://www.cnblogs.com/huxiaozhouzhou/p/10596992.html