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层封装

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

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

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

你可能感兴趣的:(Docker基本命令(docker images))