docker基本命令

docker命令

查看docker镜像

[root@localhost network-scripts]# docker images
REPOSITORY    TAG       IMAGE ID       CREATED         SIZE
hello-world   latest    feb5d9fea6a5   10 months ago   13.3kB
[root@localhost network-scripts]# docker images -a
REPOSITORY    TAG       IMAGE ID       CREATED         SIZE
redis         latest    7614ae9453d1   7 months ago    113MB
mysql         latest    3218b38490ce   7 months ago    516MB
hello-world   latest    feb5d9fea6a5   10 months ago   13.3kB
[root@localhost network-scripts]# docker images -q
7614ae9453d1
3218b38490ce
feb5d9fea6a5
[root@localhost network-scripts]# docker images -qa
7614ae9453d1
3218b38490ce
feb5d9fea6a5

查询docker镜像

[root@localhost network-scripts]# docker search redis
NAME                                       DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
redis                                      Redis is an open source key-value store that…   11200     [OK]       
bitnami/redis                              Bitnami Redis Docker Image   
[root@localhost network-scripts]# docker search redis --limit 3
NAME                       DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
redis                      Redis is an open source key-value store that…   11200     [OK]       
redis/redis-stack          redis-stack installs a Redis server with add…   10                   
redis/redis-stack-server   redis-stack-server installs a Redis server w…   8  

下载docker镜像

[root@localhost network-scripts]# docker pull redis
Using default tag: latest
latest: Pulling from library/redis
a2abf6c4d29d: Pull complete 
c7a4e4382001: Pull complete 
4044b9ba67c9: Pull complete 
c8388a79482f: Pull complete 
413c8bb60be2: Pull complete 
1abfd3011519: Pull complete 
Digest: sha256:db485f2e245b5b3329fdc7eff4eb00f913e09d8feb9ca720788059fdc2ed8339
Status: Downloaded newer image for redis:latest
docker.io/library/redis:latest

查看docker占用空间

[root@localhost network-scripts]# docker system df
TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          3         1         628.3MB   628.3MB (99%)
Containers      5         0         0B        0B
Local Volumes   0         0         0B        0B
Build Cache     0         0         0B        0B

删除images

  • 删除单个
[root@localhost network-scripts]# docker rmi -f hello-world 
Untagged: hello-world:latest
Untagged: hello-world@sha256:53f1bbee2f52c39e41682ee1d388285290c5c8a76cc92b42687eecf38e0af3f0
Deleted: sha256:feb5d9fea6a5e9606aa995e879d862b825965ba48de054caab5ef356dc6b3412
  • 删除所有
  • 可传参
[root@localhost network-scripts]# docker rmi -f $(docker images -qa)
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值