Skip to content

Feature Request: Explicitly define a internal network in docker-compose. #770

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

Open
laundmo opened this issue Dec 11, 2020 · 7 comments
Open

Comments

@laundmo
Copy link

laundmo commented Dec 11, 2020

Summary

This is a request to explicitly define docker networks in the docker-compose.

Motivation

For the purposes of adding sentry onpremise to existing networks, some containers might need to be added to a external network. This will prevent that container from accessing the default network created by docker-compose. To prevent this from happening, all containers need to be explicitly added to a network that they share with all other containers they need access to.

This is important for cases where users may want to reverse-proxy sentry themselves, especially using something like traefik.

related to #698

@github-actions
Copy link

github-actions bot commented Jan 4, 2021

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Accepted, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@laundmo
Copy link
Author

laundmo commented Feb 22, 2021

@chadwhitacre the bot seems to think this issue isn't accepted.

@getsentry getsentry deleted a comment from github-actions bot Feb 22, 2021
@chadwhitacre
Copy link
Member

Sorry @laundmo, bot went haywire due to error on my part. 😖 Should be back on track now ...

@darklow
Copy link

darklow commented May 12, 2021

I wish local network was defined explicitly and available out of the box.
Current quick workaround/hack is adding local network to restart policy block:

x-restart-policy: &restart_policy
  restart: unless-stopped
  networks:
    - local

And defining external and local networks in the end of the file:

...

networks:
  local:
  nginx-proxy:
    external: true

Now for nginx service you can add both network and all the rest services will still communicate over local network:

...
  nginx:
    <<: *restart_policy
...
    networks:
      - nginx-proxy
      - local

@BYK
Copy link
Member

BYK commented Jun 3, 2021

@darklow would you be interested in submitting a PR to get this right?

@kibble1
Copy link

kibble1 commented Aug 27, 2021

i don't believe that "external: true" is the correct solution as it means that the network was created ahead of time outside of compose and if wasn't compose will fail. - https://docs.docker.com/compose/networking/#use-a-pre-existing-network

for a network to be "internal" aka no route outside you can set internal: true

for a network to route outside it should be of type bridge

@laundmo
Copy link
Author

laundmo commented Aug 27, 2021

@kibble1 i believe the person is running a single nginx instance for all their compose files, which reverse proxies the traffic through that single external network to which all compose files connect. this is a common setup but ultimately not of any relevance to this issue/feature request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

6 participants