Docker子命令
1、信息显示
info
显示docker的详细配置信息
Containers: 9 Running: 2 Paused: 0 Stopped: 7 Images: 21 Server Version: 1.12.6 Storage Driver: devicemapper
version
-v: 显示docker版本
version :显示docker客户端、服务端信息
Client: Version: 1.12.6 API version: 1.24 Package version: docker-1.12.6-28.git1398f24.el7.centos.x86_64 Go version: go1.7.4 Git commit: 1398f24/1.12.6 Built: Fri May 26 17:28:18 2017 OS/Arch: linux/amd64 Server: Version: 1.12.6 API version: 1.24 Package version: docker-1.12.6-28.git1398f24.el7.centos.x86_64 Go version: go1.7.4 Git commit: 1398f24/1.12.6 Built: Fri May 26 17:28:18 2017 OS/Arch: linux/amd64inspect
显示镜像或者容器的详细信息,并以json格式在控制台输出
-f/--follow:获取具体属性的值
[root@iz2ze7sp5njgaf81ekoudez ~]# docker inspect -f '{{.HostConfig.NetworkMode}}' mysqldb default
2、镜像相关
build
commit
history
images
显示docker中的镜像
-a/--all: 显示所有镜像,包括中间层镜像(默认隐藏)
REPOSITORY TAG IMAGE ID CREATED SIZE <none> <none> a658dc14db82 2 weeks ago 256.6 MB
--digests:显示摘要
DIGEST sha256:f3b3b28a45160805bb16542c9531888519430e9e6d6ffc09d7226
--no-trunc:不截取输出
IMAGE ID sha256:1815c82652c03bfd8644afda26fb184f2ed891d921b20a0703b46768f9755c57
-f, --filter
--format
-q, --quiet
import
load
pull
push
rmi
save
search
tag
3、容器相关
attach
cp
create
diff
exec
export
kill
logs
pause
port
ps:列出容器,默认为启动状态的
-a/--all:显示所有的容器,包括已停止的
-q/--quiet:只显示容器的Id
-s/--size:打印容器的大小
-l/--latest:只显示最新容器,包括已停止的
-n:显示最近n个创建的容器,包括停止的,默认为-1
[root@iz2ze7sp5njgaf81ekoudez ~]# docker ps -aql 2b7210f8bb30 [root@iz2ze7sp5njgaf81ekoudez ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 2b7210f8bb30 hello-world "/hello" 21 hours ago Exited (0) 21 hours ago trusting_shockley 5e2de37c7ac1 registry.alauda.cn/library/mongo "/entrypoint.sh mongo" 4 days ago Exited (0) 4 days ago mongodb dd77a3ab72bb mysql "docker-entrypoint.sh" 4 days ago Exited (0) 22 hours ago mysqldb 5f9408697ec2 redis "docker-entrypoint.sh" 5 days ago Exited (0) 5 days ago redis-master f9ef5aac5cdf mysql "docker-entrypoint.sh" 5 days ago Exited (0) 5 days ago sharp_bell 1948ab5b3cf6 wordpress "docker-entrypoint.sh" 8 days ago Up 5 days 0.0.0.0:8081->80/tcp some-wordpress f90388331d4d mariadb "docker-entrypoint.sh" 9 days ago Exited (0) 6 days ago wordpressdb [root@iz2ze7sp5njgaf81ekoudez ~]# docker ps -l CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 2b7210f8bb30 hello-world "/hello" 21 hours ago Exited (0) 21 hours ago trusting_shockley
rename
restart
rm
run
运行镜像,生成容器
-d 后台模式运行
-e 设置环境变量
-i 连接不成功使用标准输出
-m 设置内存大小
--name 指定容器名称,默认随机生成
-t 伪终端显示
-v 挂载文件卷
-w 容器内的目录设定
start
启动一个或多个容器
stats
stop
top
unpause
update
wait
4、系统相关
events
network
node
service
swarm
volume
5、仓库
login
logout
持续完善
相关推荐
魅惑青花瓷 2020-11-11
yangkang 2020-11-09
MichaelJScofield 2020-11-06
TaoTaoFu 2020-11-06
liaochaowu 2020-11-16
ChlatZed 2020-11-11
lnkToKing 2020-10-29
ChlatZed 2020-10-27
ChlatZed 2020-10-13
时光流水 2020-09-23
yangkang 2020-09-23
changecan 2020-09-22
dusuanyun 2020-09-21
newisI 2020-09-01
liaochaowu 2020-09-14
ShangQuan0 2020-09-10
fearlessxjdx 2020-09-04
libra0 2020-09-02
ChlatZed 2020-08-23
王道革 2020-11-25
lihongtai 2020-11-09
xysoul 2020-11-03