How to set custom name to docker container?

Total
0
Shares
set custom name to docker container

In order to set custom name to a docker container, use this command –

docker run --name {custom_name} {image_name}

For example, we can run a mongodb container with custom name as my-mongo-container

docker run --name my-mongo-container mongo

This will create and run the container –

setting custom name to the docker container

We can now list all the running containers and check –

checking the custom name docker container

In this image you can see that our mongo container is running and its name is my-mongo-container.