Why does the name column of the docker ps -a always different

Unless you launch a container specifying its name (docker run --name), docker will generate one for you.
That is easier than referencing said container with its ID.

You can then make docker commands with its (generated) name instead.

See more at "How does Docker generate default container names?".
(and the source code: moby/moby pkg/namesgenerator/names-generator.go)

The command column is the full command executed by the container: once this command stops, the container stops.
That command is specified in the docker image, and is a combination of:

  • Dockerfile ENTRYPOINT
  • Dockerfile CMD

(See "difference between cmd and entrypoint in dockefile")


Basically they are random container names generated!! The left and right parts of the names are hardcoded and can be found in

https://github.com/moby/moby/blob/master/pkg/namesgenerator/names-generator.go

Docker engine generates it if default name is not provided when you create a new docker container.