How to assign a name to a running container in docker?

I created a container from a specific image using the command:

$ docker run -d -P selenium/hub 

The status of the current container is below:

 $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 345df9ed5b47 selenium/hub "/opt/bin/entry_point" 5 seconds ago Up 4 seconds 0.0.0.0:32768->4444/tcp clever_williams 

Here the default name is "clever_williams", and I forgot to give it a new name. Do I need to change the default name to the running container, so how to do it?

+6
source share
1 answer

Check if docker rename works for a running container:

 docker rename 345df9ed5b47 new_name 

(This is for dockers 1.10+, PR 8570 )

+13
source

Source: https://habr.com/ru/post/1012162/


All Articles