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 ~]# 

猜你喜欢

转载自blog.csdn.net/z19861216/article/details/134639104
今日推荐