Rename Docker Container

Rename Docker Container

When a Docker container is created, the container name is given automatically unless the --name option is specified. The automatically generated name can be hard to remember and does not specify the purpose of the container. This tutorial shows how to rename Docker container.

See names of currently running containers:

docker container ls --format "{{.ID}} {{.Image}} {{.Names}}"

Output example:

a7312ed78bb6 redis:latest app_test

To rename container, use docker rename command or docker container command with rename argument. The command accepts container ID or currently assigned name.

For example, to rename a container to redis which ID is a7312ed78bb6, you can use:

docker rename a7312ed78bb6 redis
docker container rename a7312ed78bb6 redis

For example, to rename a container app_test to redis, you can use:

docker rename app_test redis
docker container rename app_test redis

Leave a Comment

Cancel reply

Your email address will not be published.