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 ~]# 
相关推荐
m0_741768855 小时前
使用docker的小例子
运维·docker·容器
最新小梦8 小时前
Docker日志管理
运维·docker·容器
ZHOU西口9 小时前
微服务实战系列之玩转Docker(十五)
nginx·docker·微服务·云原生·swarm·docker swarm·dockerui
lgbisha10 小时前
828华为云征文|华为云Flexus X实例docker部署最新Appsmith社区版,搭建自己的低代码平台
低代码·docker·华为云
记得开心一点嘛10 小时前
在Linux系统上使用Docker部署javaweb项目
linux·运维·docker
Persistence is gold12 小时前
cassandra指定配置文件的docker启动方法
运维·docker·容器
C语言扫地僧13 小时前
Docker 镜像制作(Dockerfile)
linux·服务器·docker·容器
ken_coding16 小时前
Windows11 WSL2的ubuntu 22.04中拉取镜像报错
linux·ubuntu·docker
Richardlygo17 小时前
(k8s)Kubernetes部署Promehteus
云原生·容器·kubernetes
炸裂狸花猫18 小时前
Kubernetes从零到精通(12-Ingress、Gateway API)
容器·kubernetes·gateway