玖叶教程网

前端编程开发入门

微服务之——docker 镜像操作常用命令

docker 镜像操作常用命令

(1)、搜索镜像(在dockerhub仓库中查找centos的镜像)

[root@localhost docker]#docker search centos

找出一堆centos镜像

镜像的结构: registry_name/repository_name/image_name:tag_name

列如: docjer.io/library/alpine:3.10.1

(2)、镜像 下载、查看、打标签、推送

[root@localhost docker]#docker pull nginx (不指定版本下载的话,默认下载最新的latest)

也可以指定版本下载:

[root@localhost ~]# docker pull nginx:1.16 下载Nginx1.16 版本

还可以写全下载

[root@localhost ~]# docker pull docker.io/library/nginx:1.16

查看本地镜像

[root@localhost ~]# docker images 或者 [root@localhost ~]# docker image ls

镜像打标签

[root@localhost ~]# docker tag nginx:1.16 nginx:local

可以看到多了一个镜像名,且标签名为local

如果要把打标签的镜像上传到dockerhub上 就要严格遵守镜像的格式要求:

[root@localhost ~]# docker tag nginx:latest docker.io/feixiangkeji974907/nginx:myfirst

这里的feixiangkeji974907 要和 用户名一样

推送镜像

[root@localhost ~]# docker push docker.io/feixiangkeji974907/hello-world:test

删除标签

[root@localhost ~]# docker rmi docker.io/fxkj/alpine:latest

删除镜像(加INAME ID )

[root@localhost ~]# docker rmi fce289e99eb9

Error response from daemon: conflict: unable to delete fce289e99eb9 (must be forced) – image is being used by stopped container 3c431d073dc1

[root@localhost ~]# docker rmi -f fce289e99eb9 #-f 强制删除

查看镜像制作历史、查看镜像底层信息

[root@localhost ~]#docker history centos7:laster

[root@localhost ~]# docker inspect nginx:laster

发表评论:

控制面板
您好,欢迎到访网站!
  查看权限
网站分类
最新留言