https://pulumi.com logo
Title
s

square-library-99709

02/07/2023, 9:49 PM
👋 Hi everyone! Can anyone tell me if there is a way to add network aliases to a docker service. I can see that there is a network advanced option for containers but not in services
l

little-cartoon-10569

02/07/2023, 10:02 PM
What's a network alias? You can expose services on whatever host ports you choose. Then you can use load balancers or similar to map DNS names to that particular port on your host. There's probably other solutions, especially if you're using k8s...
s

square-library-99709

02/07/2023, 10:07 PM
The alias is the network name that other containers use to find the container not using K8s using a docker swarm
l

little-cartoon-10569

02/07/2023, 10:08 PM
Ah. Doesn't swarm use docker-compose.yml? It's all configured in there.
s

square-library-99709

02/07/2023, 10:10 PM
Yes but I am setting everything up through Pulumi without a compose file
l

little-cartoon-10569

02/07/2023, 10:11 PM
So.. not a swarm?
s

square-library-99709

02/07/2023, 10:11 PM
yes it is a swarm
the services are replicating over multiple nodes but cannot talk to each other as the aliases are missing
If I manually add these to the hostconfig of the containers all is good
what I really need is access to this
task_spec.networks_advanced
l

little-cartoon-10569

02/07/2023, 10:15 PM
Looks like service task specs can be provided container specs, that include networkAdvanced aliases...
s

square-library-99709

02/07/2023, 10:18 PM
which brings us back to the original question of how to add this in a service not a container
terraform has it for both by the looks of it
l

little-cartoon-10569

02/07/2023, 10:24 PM
Maybe it's missing from the docs only? The SDK is built from the Terraform schema, so it should match...
s

square-library-99709

02/07/2023, 10:36 PM
Terraform looks like this
pulumi has this NetworksList<string>