Docker基本命令(docker images)

Docker基本命令

命令列表

docker images

[root@docker01 ~]# docker images

REPOSITORY TAG IMAGE ID CREATED SIZE

busybox latest 22c2dd5ee85d 7 days ago 1.163 MB

ubuntu latest 452a96d81c30 12 weeks ago 79.62 MB

centos latest e934aafc2206 3 months ago 198.6 MB

registry latest d1fd7d86a825 6 months ago 33.26 MB

nginx latest a5311a310510 21 months ago 181.4 MB

redis latest 1aa84b1b434e 22 months ago 182.8 MB

docker history //查看镜像历史

 

docker inspect[root@docker01 ~]# docker history busybox

IMAGE CREATED CREATED BY SIZE COMMENT

22c2dd5ee85d 7 days ago /bin/sh -c #(nop) CMD ["sh"] 0 B //2层封装

<missing> 7 days ago /bin/sh -c #(nop) ADD file:2a4c44bdcb743a52ff 1.163 MB

[root@docker01 ~]# docker history centos

IMAGE CREATED CREATED BY SIZE COMMENT

e934aafc2206 3 months ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0 B

<missing> 3 months ago /bin/sh -c #(nop) LABEL org.label-schema.sch 0 B

<missing> 3 months ago /bin/sh -c #(nop) ADD file:f755805244a649ecca 198.6 MB //原始层

docker inspect centos //查看详细信息

[root@docker01 ~]# docker inspect centos

[

{

"Id": "sha256:e934aafc22064b7322c0250f1e32e5ce93b2d19b356f4537f5864bd102e8531f",

"RepoTags": [

"centos:latest"

],

"RepoDigests": [],

"Parent": "",

"Comment": "",

"Created": "2018-04-06T21:01:51.215822656Z",

"Container": "20e7cee1d3f15879fb54cb361e2ceb3b4cd260f90e51202feec140f1aa9d8527",

"ContainerConfig": {

 

"Env": [

"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

], //环境变量

"Cmd": [

"/bin/sh",

"-c",

"#(nop) ",

"CMD [\"/bin/bash\"]"

], //启动命令

 

[root@docker01 ~]# docker inspect nginx

"Env": [

"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",

"NGINX_VERSION=1.11.5-1~jessie"

],

"Cmd": [

"nginx",

"-g",

"daemon off;"

],

docker pull //下载镜像

docker push //上传镜像

docker rmi //删除本地镜像(后端文件)

[root@docker01 ~]# docker rmi busybox:latest

Error response from daemon: conflict: unable to remove repository reference "busybox:latest" (must force) - container 320fd4c0ba44 is using its referenced image 22c2dd5ee85d

//已有容器(前端盘)在使用

 

docker save //镜像另存为tar包

docker load //使用tar包导入镜像

docker search //搜索镜像

//软连接,对应文件的ID一致 docker tag给文件创建新的名字

[root@docker01 ~]# docker tag centos:latest abc:ooxx

[root@docker01 ~]# docker images

REPOSITORY TAG IMAGE ID CREATED SIZE

busybox latest 22c2dd5ee85d 7 days ago 1.163 MB

ubuntu latest 452a96d81c30 12 weeks ago 79.62 MB

abc ooxx e934aafc2206 3 months ago 198.6 MB

centos latest e934aafc2206 3 months ago 198.6 MB

registry latest d1fd7d86a825 6 months ago 33.26 MB

nginx latest a5311a310510 21 months ago 181.4 MB

redis latest 1aa84b1b434e 22 months ago 182.8 MB

[root@docker01 ~]# docker rmi abc:ooxx

Untagged: abc:ooxx

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

乐于技术分享

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值