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

fabric_orderer1.1.ush25segkzu798fwortpaoebv

I want them to look like this

orderer1.example.com

is there any way to change the container names?

Hello,
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,
Fouscou

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