镜像

概念

  镜像是启动容器的模板,同一个镜像启动的所有的容器完全相同

下载镜像

docker pull [仓库的URL]/[命名空间]/[镜像名称]:[版本号]
默认的仓库URL:https:
//index.docker.io/v1/ 默认的命名空间:library 默认的版本号:latest
# 例子: index.docker.io
/library/nginx:latest

查看本机镜像列表

# 两个命令都是查看
[root@localhost ~]# docker images
[root@localhost ~]# docker image ls

# 镜像详情介绍
REPOSITORY   TAG       IMAGE ID       CREATED      SIZE
nginx        latest    f6987c8d6ed5   6 days ago   141MB
仓库名       版本       镜像ID         创建距离现在的时间 大小

查看镜像详情

docker inspect [镜像名称|ID]

  能够查看镜像的具体信息,比上面的更详细

镜像tag

docker tag [镜像ID] [新的名称]

  相当于起别名

登录仓库

docker login [仓库的URL地址]
默认的仓库地址:hub.docker.com

上传镜像

# 第一步:打tag
[root@localhost ~]# docker tag f6987c8d6ed5 alvinos/nginx:v2
# 第二步:上传
[root@localhost ~]# docker push alvinos/nginx:v2

删除镜像

docker rmi [镜像的名称|ID]
[root@localhost ~]# docker rmi alvinos/nginx:v2

注:

  docker镜像只能创建和删除,不能修改

  docker的ID是唯一的

posted @ 2022-07-24 13:26  那就凑个整吧  阅读(208)  评论(0编辑  收藏  举报