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

order of networks in nginx template is random #431

Open
JanMalte opened this issue May 1, 2022 · 2 comments
Open

order of networks in nginx template is random #431

JanMalte opened this issue May 1, 2022 · 2 comments

Comments

@JanMalte
Copy link

JanMalte commented May 1, 2022

I'm not quite sure if this is a docker-gen issue or maybe a nginx-proxy template issue.

I'm using the three container setup for a nginx proxy and noticed multiple nginx restarts due to changed default.conf

Comparing the generated conf files showed me, that the changes are only for the network comment lines.

/nginx-proxy # diff -W 90 -y --suppress-common-lines generated-11.conf generated-12.conf
        # Cannot connect to network 'elm    <
					    >	        # Cannot connect to network 'elmar
        # Cannot connect to network 'git    <
					    >	        # Cannot connect to network 'gitla
        # Cannot connect to network 'hc-    <
					    >	        # Cannot connect to network 'hc-vo
        # Cannot connect to network 'sec    <
					    >	        # Cannot connect to network 'secon
					    >	        # Cannot connect to network 'stats
        # Cannot connect to network 'sta    <
        # Cannot connect to network 'elm    <
					    >	        # Cannot connect to network 'elmar
        # Cannot connect to network 'sec    <
					    >	        # Cannot connect to network 'secon

Related "discussion": nginx-proxy/nginx-proxy#1981 (comment)

@JanMalte
Copy link
Author

Fixed in current main branch of nginx-proxy
nginx-proxy/nginx-proxy#2183

@rhansen
Copy link
Collaborator

rhansen commented Feb 21, 2023

I'm going to reopen this because I think that a few straightforward tweaks to docker-gen will make life easier for all template authors. Specifically: when order doesn't matter, slices in the template context should be sorted before executing the template. (IIUC, docker-gen currently returns objects in the same order received from Docker, which is apparently not very stable.)

@rhansen rhansen reopened this Feb 21, 2023
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