In this blog post, We will rename a Docker container name while the container is running.
Renaming a running container is a task that you might encounter while managing a Docker environment or as part of a deployment.
The Docker CLI made the task of renaming a running container possible without restarting or deleting the container.
In the following example, I will deploy a Docker container that has a volume attached to it. After the container has been deployed, I will rename the container using the docker rename command.
docker run --name deploy01 -ti -v /host:/data ubuntu:latest /bin/bash
After deploying the container, I will rename it using the following command. The current name is deploy01, and I will change it to deploy02.
docker rename deploy01 deploy02