# How to change the name of a Docker container

In 
Published 2022-12-03

This tutorial explains to you how we can change the name of a Docker container. You will see an example for this tutorial as well.

If you want to create a Docker container on which you want to deploy something, you need to have a Docker image. Each Docker container is based on a Docker image and each Docker container has a name. A container name is given automatically when you create a container if you are not using the "--name" option.

Sometimes you want to change the name of a Docker container. This can be done using the docker container rename command.

Example:
docker container rename d582704d9654 myNewName

The syntax of the command I used is:

docker container rename CONTAINER NEW_NAME

You can run the following command before and after the container name change, in order to see the change:

docker container ls --format "{{.ID}}: {{.Names}}: {{.Status}}"

As you can see, changing the name of a Docker container is an easy task.

Enjoy working with Docker images and Docker containers !