Fix problem with docker internal networks#350
Closed
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello, I found an issue while setting up
nginx-proxycontainer for my network.I have the following setup:
--internalparameterContainer with
nginx-proxyconnected to bothAandBnetworks. At the same time, containers with applications are connected only to 'B' network. When running such a config, I was always getting.After investigating, I find out that the issue comes from the fact that 'docker inspect' section
NetworkSettings.Portsis always empty for internal networks, no matter which port you expose/publish. As the result we always have emptyaddressesvariable when we generate a template. Solution here is to take exposed ports from sectionConfig.ExposedPortswhenNetworkSettings.Portsis empty.How to reproduce:
Create internal network
docker network create 'test_network' --internalRun httpd container connected on this network
docker run --network test_network --rm -e VIRTUAL_HOST=test.local -e VIRTUAL_PORT=80 httpd:2.4-alpineGet latest nginx.tml
wget https://raw.githubusercontent.com/nginx-proxy/nginx-proxy/main/nginx.tmplRun
docker run --network test_network -it --rm -v /run/docker.sock:/tmp/docker.sock -v $(pwd):/app/ jwilder/docker-gen /app/nginx.tmplYou will see that in the
upstreamsection of the generated configserverdirective is marked asdown.Repeat all the steps but this time, on step 1, create a network without the
--internalparameter.