Let's say that I have launch a service in Swarm like this :
docker service create --replicas 1 --name helloworld busybox bash
Is there any way to know that the container that will be run is controlled by a service called "helloworld"?
Let's say that I have launch a service in Swarm like this :
docker service create --replicas 1 --name helloworld busybox bash
Is there any way to know that the container that will be run is controlled by a service called "helloworld"?
You can't. Containers do not know about the current architecture they are being run into. And that is well.
If you tell a container how is designed its hosting architecture, and then rely on it from within the container, you instantly lose all the modularity and scalability of using Swarm.
Nevertheless, you might need to configure some stuff for your container. I would advise to use environment variables and pass through the information you need.