Why boring_wozniak Will Never Be Generated as a Container Name in Docker?

Guray Yildirim
peptr
Published in
3 min readMay 3, 2020

When creating containers with Docker, one doesn’t have to give them names. By default, if there is no name provided, Docker itself generates a name for the container. Docker will select an adjective and add the name of a scientist or hacker name at the end of it, joining via an underscore.

Inspecting Container Names Generated by Docker

We can see these names when we create containers with Docker and without specifying names for them. Let’s create a couple of containers and look for their names:

Generating 10 containers with a while loop in bash

And to list the names of them, we can utilize format:

Container name examples generated by Docker

When we check the names, the adjective_name format has become obvious. The reason for that naming is names-generator.go file in source code which has written in Go. You can reach the file from here.

We can see the list of adjectives at the left, starting from line 9:

Some of the left side alternatives for container names generated by Docker

Possibilities for the right side for container names are listed starting from line 122:

Some of the right side alternatives for Docker generated container names

After this introductory information, let’s see the reason why there will be no container name as “boring_wozniak” generated by Docker. The answer resides at line 844:

So, because of the comment “Steve Wozniak is not boring” it will go back and generate a new name if the current generated name is “boring_wozniak”. The more interesting part is that the program might be stuck here if it constantly generates boring_wozniak due to the goto line’s not having a retry limit; even if which seems not possible, though.

Despite all these obstacles, if you want to name a container as “boring_wozniak”, it is possible by giving the name with name parameter when creating a container, or using docker rename subcommand on an existing container.

It is possible to take a small tour with git’s blame feature in case of wondering it is coded by who and when. In that case, the tour ends with a commit by Solomon Hykes on November 24, 2013.

--

--

Guray Yildirim
peptr
Editor for

DevOps Consultant. Author of 3 books. Seriously passionate about Kubernetes, Docker (container tech). Coding mostly in Python. — Reach out for work connections.