Pratik Patel Pratik Patel - 27 days ago 7
Linux Question

How to assign a name to running container in docker?

I have created container from particular image using command:

$ docker run -d -P selenium/hub


running container status 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 default name is "clever_williams" and I forgot to assign new name to it
I need to change default name to running container so how can I do that?

Answer

Check if docker rename works for a running container:

docker rename 345df9ed5b47 new_name

(This is for docker 1.10+, from PR 8570)

Comments