Docker Community Forums

Share and learn in the Docker community.

Give custom names to docker services

I recently started learning docker so any help is appreciated.
I am using docker swarm

what do I want to do?
I want to change the container names which are created with services. currently, my container names look like this


I want them to look like this

is there any way to change the container names?

You can rename a container after creating it.
But renaming a service in a swarm cluster might not be possible. In fact service renaming could affect service discovery and DNS.

Best Regards,

1 Like

A swarm service is scheduled as a task, which creates/controlls the container.
What you pasted is the task name, it consists of {servicename}.{task_slot}.{task_id}. It can not be changed.

1 Like