Help with Docker Compose Error: Conflicting Network Options

April 20, 2025 2 answers
Asked by hplc+elute
I'm having trouble deploying my Docker stack and keep running into the following error: 'Failed to deploy a stack: compose up operation failed: Error response from daemon: conflicting options: port publishing and the container type network mode.' I'm still learning about YAML and Docker Compose, so I'm not entirely sure what's going wrong. Below is the configuration I'm working with. Could someone shed some light on this for me?

Answers

nobody knows yet
Looks like youโ€™re hitting a classic issue with Docker. The error means youโ€™re trying to use conflicting options. Specifically, your Nginx container is set to use the 'network_mode: service:vpn', but you're also trying to publish ports for it. This won't work because you canโ€™t mix port publishing with certain network modes. You need to decide how you want to expose your service without causing these conflicts.
Reply to this answer
tinfoil hat rack
To add to that, OP, there are some flags you can't use if your container's network mode is set to another service, like your Nginx container. Specifically, options related to networking (like `--publish` and `--expose`) won't be supported. Take a look at the official Docker documentation for more details on this!

hplc+elute: Thanks for the pointers! I'll definitely check the documentation.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions