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

I get a strange error when starting my nginx-gen container #3

Open
selenwall opened this issue May 12, 2017 · 6 comments
Open

I get a strange error when starting my nginx-gen container #3

selenwall opened this issue May 12, 2017 · 6 comments

Comments

@selenwall
Copy link

Have tried to figure this one out myself, but no. Seriously, it is not a directory.

nginx-gen | 2017/05/12 04:17:44 Unable to parse template: read /etc/docker-gen/templates/nginx.tmpl: is a directory
nginx-gen | 2017/05/12 04:17:46 Error inspecting container: 0c1bc124d911f35483317010a5f55035df99452631ac19290a0e089b427c1641: No such container: 0c1bc124d911f35483317010a5f55035df99452631ac19290a0e089b427c1641
nginx-gen | 2017/05/12 04:17:46 Unable to parse template: read /etc/docker-gen/templates/nginx.tmpl: is a directory
nginx-gen | 2017/05/12 05:08:01 Unable to parse template: read /etc/docker-gen/templates/nginx.tmpl: is a directory
nginx-gen | 2017/05/12 05:08:02 Unable to parse template: read /etc/docker-gen/templates/nginx.tmpl: is a directory

@gilyes
Copy link
Owner

gilyes commented May 12, 2017

Assuming you are using the original docker-compose.yml, are you sure that ./volumes/proxy/templates/nginx.tmpl is present on the host machine? That is the file that is mapped to the container's /etc/docker-gen/templates/nginx.tmpl. If the host folder/file does not exist when running docker-compose up then the volume mapping will automatically create an empty folder with the name of that file, leading to the above error.

@ivanistheone
Copy link

The relevant part in the above error is:
Unable to parse template: read /etc/docker-gen/templates/nginx.tmpl: is a directory letsencrypt-nginx-proxy-companion | Sleep for 3600s

I tried changing the line

  - "./volumes/proxy/templates/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro"

to

  - "./volumes/proxy/templates:/etc/docker-gen/templates:ro"

but doesn't seem to do the trick. Any ideas?

@gilyes
Copy link
Owner

gilyes commented Jun 28, 2017

As mentioned above, I've only seen this error when the file in question (./volumes/proxy/templates/nginx.tmpl) did not exist on the host and the volume mapping automatically created an empty directory using the same name as the file. Does ./volumes/proxy/templates/nginx.tmpl file (not directory) exist, relative to the directory of the docker-compose.yml file?

@ivanistheone
Copy link

I think this is an issue only when running the sample project on a remote docker host, e.g. one created by docker-machine.

One possible fix is to create a dummy container for the template file, see
https://github.com/fle-internal/sushibar/commit/558c0e8886004b413b63d7fd80935384f024f6af

inspired by fatk/docker-letsencrypt-nginx-proxy-companion-examples#5 (comment)

@gilyes
Copy link
Owner

gilyes commented Jun 28, 2017

Makes sense, thanks for letting me know.

@ivanistheone
Copy link

To followup on that issue, it seems when using a remote host with docker-machine it is the user's responsibility to populate the volumes directory on the remote docker host (see https://stackoverflow.com/a/30512262/127114).

A workaround is to make the sample-website a self-contained Docker image so it won't depend on any volumes. This is how I did it: https://github.com/fle-internal/sushibar/commit/474fbd33a22eb6206ea52266f1f103b81e60d4a0

Note also I had to change VIRTUAL_NETWORK=nginx-proxy to VIRTUAL_NETWORK=<compose_proj_name>_default because otherwise nginx wasn't able to talk to sample-website.

Works great now! @gilyes thanks for saving me weeks figuring out this whole stack... very useful project, so happy I found it.

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

3 participants