Bootstrap FreeKB - Docker - Assign a name to a container using the docker run --name command
Docker - Assign a name to a container using the docker run --name command

Updated:   |  Docker articles

When creating a container using the docker run command, the --name option can be used to give the container a specific name. In this example, a container is created using the foo:latest image, and the name of the container will be foo.

docker run --name foo foo:latest

 

The docker container ls or docker ps -a command can then be used to display the container. Notice the name of the container is foo.

~]# docker container ls
CONTAINER ID   IMAGE       COMMAND                 CREATED        STATUS   PORTS  NAMES
d937372c09ab9  foo:latest  "/docker-entrypoin..."  6 minutes ago  Created         foo

 

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter cc0c89 in the box below so that we can be sure you are a human.