目录
帮助命令
Dokcer官方帮助文档地址:Redirecting…https://docs.docker.com/engine/reference/commandline/
docker -v 或 docker version 显示docker的版本信息
docker info 显示docker的系统信息,包括镜像和容器的数量
docker 命令 --help 帮助命令
镜像命令
docker images 查看所有本地的主机上的镜像
[root@docker ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest d1165f221234 5 months ago 13.3kB
# 解释
REPOSITORY 镜像的仓库源
TAG 镜像的标签
IMAGE ID 镜像的id
CREATED 镜像的创建时间
SIZE 镜像的大小
# 可选参数
-a, --all # 列出所有的镜像 --Show all images
-q, --quiet # 只显示镜像的id --Only show image IDs
docker search 搜索镜像
[root@docker ~]# docker search mysql
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
mysql MySQL is a widely used, open-source relation… 11312 [OK]
mariadb MariaDB Server is a high performing open sou… 4299 [OK]
# 可选参数,通过提供的条件来过滤
-f, --filter=STARS=3000 # 搜索出来的镜像就是STARS大于3000的
[root@docker ~]# docker search mysql --filter=STARS=3000
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
mysql MySQL is a widely used, open-source relation… 11312 [OK]
mariadb MariaDB Server is a high performing open sou… 4299 [OK]
docker pull 下载镜像
# docker pull 镜像名[:tag]
[root@docker ~]# docker pull mysql
Using default tag: latest # 如果不写tag,默认就是latest
latest: Pulling from library/mysql
bed879327370: Pull complete # 分层下载,docker image的核心,联合文件系统
03285f80bafd: Pull complete
ccc17412a00a: Pull complete
1f556ecc09d1: Pull complete
adc5528e468d: Pull complete
1afc286d5d53: Pull complete
6c724a59adff: Pull complete
0f2345f8b0a3: Pull complete
c8461a25b23b: Pull complete
3adb49279bed: Pull complete
77f22cd6c363: Pull complete
Digest: sha256:d45561a65aba6edac77be36e0a53f0c1fba67b951cb728348522b671ad63f926 # 签名
Status: Downloaded newer image for mysql:latest
docker.io/library/mysql:latest # 真实地址
# 二者等价
docker pull mysql
docker pull docker.io/library/mysql:latest
# 指定版本下载
[root@docker ~]# docker pull mysql:5.7
5.7: Pulling from library/mysql
e1acddbe380c: Already exists
bed879327370: Already exists
03285f80bafd: Already exists
ccc17412a00a: Already exists
1f556ecc09d1: Already exists
adc5528e468d: Already exists
1afc286d5d53: Already exists
4d2d9261e3ad: Pull complete
ac609d7b31f8: Pull complete
53ee1339bc3a: