docker镜像命令

1、docker images

查看镜像

# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE

#解释
REPOSITORY 镜像的仓库源
TAG 镜像标签
IMAGE ID 镜像id
CREATED 镜像的创建时间
SIZE 镜像的大小

#可选项
Options:
    -a, --all # 列出所有镜像
    -q, --quiet # 只显示镜像id

2、docker search

搜索镜像

# docker search mysql
NAME DESCRIPTION
STARS OFFICIAL AUTOMATED
mysql MySQL is a widely used, open-source relation… 9604      [OK]
mariadb MariaDB is a community-developed fork of MyS… 3490    [OK]


#可选项,通过收藏来过滤
--filter=STARS=3000 #搜索出来的镜像就是STARS大于3000的
[root@localhost /]# docker search mysql --filter=STARS=3000
NAME DESCRIPTION STARS
OFFICIAL AUTOMATED
mysql MySQL is a widely used, open-source relation… 9604      [OK]
mariadb MariaDB is a community-developed fork of MyS… 3490    [OK]

3、docker pull

下载镜像

# 下载镜像 docker pull 镜像名[:tag]
[root@localhost /]# docker pull mysql
Using default tag: latest # 如果不写 tag,默认就是latest
latest: Pulling from library/mysql
8559a31e96f4: Pull complete # 分层下载,docker image的核心 联合文件系统
d51ce1c2e575: Pull complete
c2344adc4858: Pull complete
fcf3ceff18fc: Pull complete
16da0c38dc5b: Pull complete
b905d1797e97: Pull complete
4b50d1c6b05c: Pull complete
c75914a65ca2: Pull complete
1ae8042bdd09: Pull complete
453ac13c00a3: Pull complete
9e680cd72f08: Pull complete
a6b5dc864b6c: Pull complete
Digest:
sha256:8b7b328a7ff6de46ef96bcf83af048cb00a1c86282bfca0cb119c84568b4caf6 # 签名
Status: Downloaded newer image for mysql:latest
docker.io/library/mysql:latest # 真实地址
docker pull mysql 等价于: docker pull docker.io/library/mysql:latest



# 指定版本下载
[root@localhost /]# docker pull mysql:5.7
5.7: Pulling from library/mysql
8559a31e96f4: Already exists # 联合文件系统的好处:上面下载过的MySQL与5.7版本的
MySQL有相同的文件时不需要重复下载
d51ce1c2e575: Already exists
c2344adc4858: Already exists
fcf3ceff18fc: Already exists
16da0c38dc5b: Already exists
b905d1797e97: Already exists
4b50d1c6b05c: Already exists
d85174a87144: Pull complete
a4ad33703fa8: Pull complete
f7a5433ce20d: Pull complete
3dcd2a278b4a: Pull complete
Digest:
sha256:32f9d9a069f7a735e28fd44ea944d53c61f990ba71460c5c183e610854ca4854
Status: Downloaded newer image for mysql:5.7
docker.io/library/mysql:5.7

4、docker rmi 镜像

删除镜像

# docker rmi -f 镜像id #删除指定镜像
# docker rmi -f 镜像id 镜像id 镜像id #删除多个镜像
# docker rmi -f $(docker images -aq) #删除全部镜像

你可能感兴趣的:(docker,运维,容器)