Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
[root@centos7 ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE nginx alpine 6f715d38cfe0 2 weeks ago 22.1MB nginx latest 4bb46517cac3 2 weeks ago 133MB
# 查看是否生产新的镜像 [root@centos7 ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE user/centos v2 8aee4e075a0d 12 seconds ago 203MB
# 启动新的镜像容器 [root@centos7 ~]# docker run -itd user/centos:v2 /bin/bash 799efd51587574113896b3c3218b08664b864c155490ca2728e65452a9f44901
# 查看启动的容器 [root@centos7 ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 799efd515875 user/centos:v2 "/bin/bash" 4 seconds ago Up 3 seconds elastic_euclid 4d95f2fd7cfb centos:centos7.8.2003 "/bin/bash" 5 minutes ago Up 5 minutes angry_cori
# 停止旧的容器 [root@centos7 ~]# docker stop 4d95f2fd7cfb 4d95f2fd7cfb # 删除旧的容器 [root@centos7 ~]# docker rm 4d95f2fd7cfb 4d95f2fd7cfb # 查看剩余容器状态 [root@centos7 ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 799efd515875 user/centos:v2 "/bin/bash" 3 minutes ago Up 3 minutes elastic_euclid
设置镜像标签
使用 docker tag 命令,为镜像添加一个新的标签。
1 2 3 4 5 6 7 8 9 10 11 12 13
# 查看镜像 [root@centos7 ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE nginx alpine 6f715d38cfe0 2 weeks ago 22.1MB
# 为镜像搭上tag号 [root@centos7 ~]# docker tag 6f715d38cfe0 nginx:new
# 确认最终状态,生成两个镜像,可以理解为复制镜像 [root@centos7 ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE nginx alpine 6f715d38cfe0 2 weeks ago 22.1MB nginx new 6f715d38cfe0 2 weeks ago 22.1MB