帮助命令
docker version # 显示版本信息
docker info #显示docker的系统信息,包括镜像和容器的数量
docker --help #帮助命令
镜像命令
docker images (查看所有本地主机上的镜像)

options:
-a, --all Show all images (default hides intermediate images)
--digests Show digests
-f, --filter filter Filter output based on conditions provided
--format string Pretty-print images using a Go template
--no-trunc Don't truncate output
-q, --quiet Only show image IDs
docker search (搜索镜像)
语法:
docker search [OPTIONS] TERM
options:
-f, --filter filter Filter output based on conditions provided
--format string Pretty-print search using a Go template
--limit int Max number of search results (default 25) # 限制搜索的结果数
--no-trunc Don't truncate output #不要截断式输出,输出完整信息
测试:

[root@VM-4-17-centos /]# docker search --filter=stars=4800 mysql #搜索srars >= 4800 的镜像
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
mysql MySQL is a widely used, open-source relation… 12456 [OK]
mariadb MariaDB Server is a high performing open sou… 4800 [OK]
docker pull 下载镜像
语法:
docker pull [OPTIONS] NAME[:TAG|@DIGEST]
如果不指定tag,默认会下载最新版:
[root@VM-4-17-centos docker]# docker pull mysql
Using default tag: latest
latest: Pulling from library/mysql
72a69066d2fe: Pull complete # 分层下载 docker image的核心 联合文件系统
93619dbc5b36: Pull complete
99da31dd6142: Pull complete
626033c43d70: Pull complete
37d5d7efb64e: Pull complete
ac563158d721: Pull complete
d2ba16033dad: Pull complete
688ba7d5c01a: Pull complete
00e060b6d11d: Pull complete
1c04857f594f: Pull complete
4d7cfa90e6ea: Pull complete
e0431212d27d: Pull complete
Digest: sha256:e9027fe4d91c0153429607251656806cc784e914937271037f7738bd5b8e7709 #签名
Status: Downloaded newer image for mysql:latest
docker.io/library/mysql:latest # 真实地址
下载指定版本:

docker rmi 删除镜像
语法:
docker rmi [OPTIONS] IMAGE [IMAGE...]
Options:
-f, --force Force removal of the image
--no-prune Do not delete untagged parents
删除指定的镜像:
[root@VM-4-17-centos docker]# docker rmi -f 镜像id
[root@VM-4-17-centos docker]# docker rmi -f 镜像id 镜像id 镜像id #删除多个指定的镜像
删除所有的镜像:
[root@VM-4-17-centos docker]# docker rmi -f $(docker images -aq)
docker image COMMAND (管理镜像)
docker image build
容器命令 (有了镜像才可以创建容器)
下载一个镜像:
docker pull centos
docker run (启动容器)
语法:
docker run [OPTIONS] IMAGE

最低0.47元/天 解锁文章
1053

被折叠的 条评论
为什么被折叠?



