4-Docker命令之docker rename

1.docker rename介绍

docker rename命令是用于重命名一个docker容器

2.docker rename用法

docker rename container New_Name

复制代码
[root@centos79 ~]# docker rename --help

Usage:  docker rename CONTAINER NEW_NAME

Rename a container

Aliases:
  docker container rename, docker rename
[root@centos79 ~]# 

3.实例

3.1.重命名运行的容器名称

命令:

docker rename centos-nginx centos-nginx-1.0

复制代码
[root@centos79 ~]# docker ps | grep 42574
425747b4385b   centos-nginx:1.0       "nginx -g 'daemon of..."   4 days ago    Up 2 hours   0.0.0.0:80->80/tcp, :::80->80/tcp                                                      centos-nginx
[root@centos79 ~]# docker rename centos-nginx centos-nginx-1.0
[root@centos79 ~]# docker ps | grep 42574
425747b4385b   centos-nginx:1.0       "nginx -g 'daemon of..."   4 days ago    Up 2 hours   0.0.0.0:80->80/tcp, :::80->80/tcp                                                      centos-nginx-1.0
[root@centos79 ~]# 

3.2.重命名未运行的容器名称

命令:

docker rename busy_taussig hello-world

复制代码
[root@centos79 ~]# docker ps -a | grep 8f8686
8f86869d31a8   hello-world            "/hello"                  3 days ago    Exited (0) 3 days ago                                                                                            busy_taussig
[root@centos79 ~]# docker rename busy_taussig hello-world
[root@centos79 ~]# docker ps -a | grep 8f8686
8f86869d31a8   hello-world            "/hello"                  3 days ago    Exited (0) 3 days ago                                                                                            hello-world
[root@centos79 ~]# 
相关推荐
容器魔方37 分钟前
中选名单出炉|18位学生入选开源之夏KubeEdge课题,欢迎加入!
云原生·容器·云计算
保持学习ing1 小时前
day1--项目搭建and内容管理模块
java·数据库·后端·docker·虚拟机
susu10830189112 小时前
Debian 11 Bullseye 在线安装docker
运维·docker·debian
love530love3 小时前
Docker 稳定运行与存储优化全攻略(含可视化指南)
运维·人工智能·windows·docker·容器
人生匆匆3 小时前
docker进入启动失败的容器
运维·docker·容器
退役小学生呀4 小时前
十、K8s集群资源合理化分配
linux·云原生·容器·kubernetes·k8s
魂尾ac7 小时前
Centos Docker 安装(100%成功)
linux·docker·centos
Johny_Zhao13 小时前
Docker + CentOS 部署 Zookeeper 集群 + Kubernetes Operator 自动化运维方案
linux·网络安全·docker·信息安全·zookeeper·kubernetes·云计算·系统运维
zwjapple14 小时前
docker-compose一键部署全栈项目。springboot后端,react前端
前端·spring boot·docker
代码老y16 小时前
Docker:容器化技术的基石与实践指南
运维·docker·容器