How to get the next friendly name that Docker will assign to the container it will make? Background

When you start a Docker container as in the following example:

$ docker run -ti ubuntu:latest


Docker docker automatically assigns the container an ID and a friendly name.

Docker friendly names are of the format adjective_famousPerson.

Problem

I would like to get the friendly name that Docker will generate for the next container, so that I can assign that name to the hostname parameter of my docker run command.

For example:

$ docker run -ti --hostname docker.next_friendly_name ubuntu:latest


Question

Is there a built in way to do this with docker?

I need a friendly name that is randomly generated, but I don't want to script it up myself if there is a way to do this with Docker or even Docker Swarm or Kubernetes.

Additionally, the name of the container and the hostname of the container need to match.
As the name of the container is randomly generated you cannot get it before it's generated (by definition). You can use this service to generate random names :

NAME=$(curl -s https://frightanic.com/goodies_content/docker-names.php); \
docker run -ti --name $NAME --hostname $NAME ubuntu:latest