Docker Community Forums

Share and learn in the Docker community.

Stack service containers dynamic hostname

(Peterlauri) #1

I am migrating away from Docker Cloud to pure Docker Swarm setup. One thing that I am missing is the nice way of how the containers got the hostname set as $SERVICE_NAME-$SLOT_NUMBER.

Is it possible to dynamically set the hostname/container name in a swarm stack service?

(Peterlauri) #2

While I was posting the question on SO, I figured it out: