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 ~]# 
相关推荐
ITCharge28 分钟前
Docker 万字教程:从入门到掌握
后端·docker·容器
智想天开1 小时前
13.组合模式:思考与解读
docker·设计模式·容器·组合模式
Sirius Wu1 小时前
TiDB 深度解析与 K8S 实战指南
容器·kubernetes·tidb
马大胡子2 小时前
Greenbone(绿骨)开源GVM容器docker部署和汉化介绍
linux·网络安全·docker
AdaTina3 小时前
Docker的分解分析
运维·docker·容器
weisian1513 小时前
云原生--核心组件-容器篇-7-Docker私有镜像仓库--Harbor
docker·云原生·容器
明天不下雨(牛客同名)6 小时前
Docker和K8s面试题
docker·容器·kubernetes
平谷一勺7 小时前
docker存储
运维·docker·容器
zhang-ge8 小时前
docker本地部署ClipCascade,实现跨设备剪贴板同步
docker·容器
IT闫8 小时前
【Docker】——在Docker工具上安装创建容器并完成项目部署
运维·docker·容器