Belen
Belen

Reputation: 943

How to name a container with docker run

How is possible to assign a name to a container while using docker run with interactive mode?

For example, running this command

docker run -d -it docker_image_already_created sh

when checking with docker ps the name is autogenerated. How can the container name be passed?

Upvotes: 38

Views: 52817

Answers (1)

Marvin
Marvin

Reputation: 14255

Provide the --name option:

docker run -d --name your_name -it docker_image_already_created sh

Upvotes: 70

Related Questions