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
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.
$ docker run -ti --hostname docker.next_friendly_name ubuntu:latest
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.
name of the container and the
hostname of the container need to match.