Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

service unbound declares mutually exclusive network_mode and networks: invalid compose project #158

Open
cmonty14 opened this issue Jan 28, 2024 · 5 comments

Comments

@cmonty14
Copy link

cmonty14 commented Jan 28, 2024

Describe the bug
Running docker compose pull fails with error.

To Reproduce
Steps to reproduce the behavior:

  1. Create compose file docker-compose.yml
  2. Run docker compose pull

Expected behavior
Deployment of unbound container finishes w/o error.

Error messages
service unbound declares mutually exclusive `network_mode` and `networks`: invalid compose project

Additional context
Using a modified docker-compose.yml file:

version: '3'
services:
  unbound:
    container_name: unbound
    image: "mvance/unbound:latest"
    expose:
      - "53"
    networks:
     - dns
    network_mode: bridge
    ports:
      - target: 53
        published: 53
        protocol: tcp
        mode: host
      - target: 53
        published: 53
        protocol: udp
        mode: host
      - target: 8953
        published: 8953
        protocol: tcp
        mode: host
[...]
@MatthewVance
Copy link
Owner

The issue is with the compose file. You reference "dns" under networks, but you don't define a dns network in the compose file. https://docs.docker.com/compose/networking/#specify-custom-networks

@cmonty14
Copy link
Author

Actually I just copied the docker-compose file from documentation.

@MatthewVance
Copy link
Owner

The file snippet above doesn't match the documentation. It's missing the networks and volume declarations at the bottom.

networks:
  dns:

volumes:
  mydata:

@cmonty14
Copy link
Author

cmonty14 commented Feb 1, 2024

It's correct that my snipped does not include the complete docker-compose.yml file.
If you check the screenshot below you'll see that it includes all lines, but the error persists.
Bildschirmfoto vom 2024-02-01 06-48-40

@MatthewVance
Copy link
Owner

Try the updated Docker Compose example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants