Skip to content

Docker-Gen Cannot Generate Configuration #15

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

Closed
maxexcloo opened this issue Jun 7, 2014 · 5 comments
Closed

Docker-Gen Cannot Generate Configuration #15

maxexcloo opened this issue Jun 7, 2014 · 5 comments

Comments

@maxexcloo
Copy link

When the output file is set to be written to a volume, docker-gen is unable to create the configuration there due to what appears to be a hard link error.

@maxexcloo
Copy link
Author

Example is in my HAProxy Configuration Generator container and the HAProxy container itself:

HAProxy Config
https://github.com/maxexcloo/Docker/tree/master/apps/haproxy-config
docker run --name="haproxy-config" -v /var/run/docker.sock:/tmp/docker.sock -i -t maxexcloo/haproxy-config

HAProxy
https://github.com/maxexcloo/Docker/tree/master/apps/haproxy
docker run --name="haproxy" --volumes-from="haproxy-config" -p 80:80 -p 443:443 -i -t maxexcloo/haprox

@jwilder
Copy link
Collaborator

jwilder commented Jun 8, 2014

I'm not sure what's happening. I tried your containers but but wasn't quite sure how to use them. I'll see if I can reproduce using --volumes-from. If you have some steps that I can follow to reproduce the error that would be helpful.

@maxexcloo
Copy link
Author

Basically if the generated template output path is on an external volume there is a copy error, I believe due to how linux handles hardlinks.

@smirolo
Copy link

smirolo commented Jun 14, 2014

I seem to have the same (or related) issue:

$ ./docker-gen -only-exposed -watch -notify "/etc/init.d/nginx reload"     nginx.tmpl /etc/nginx/conf.d/default.conf
2014/06/14 11:17:35 unable to create dest file /etc/nginx/conf.d/default.conf: rename /tmp/docker-gen598781669 /etc/nginx/conf.d/default.conf: invalid cross-device link

$ df
Filesystem              1K-blocks    Used Available Use% Mounted on
/dev/mapper/fedora-root  17938864 3173340  13831228  19% /
tmpfs                      505400      44    505356   1% /tmp

Most likely because docker-gen tries to do a file rename instead of a file copy.

#https://github.com/jwilder/docker-gen/blob/master/template.go#L106
err = os.Rename(dest.Name(), config.Dest)

I managed to workaround the problem by explicitly overriding the TMPDIR shell variable as such (for example):

TMPDIR=/etc/nginx/tmp ./docker-gen -only-exposed -watch -notify "/etc/init.d/nginx reload" nginx.tmpl /etc/nginx/conf.d/default.conf

@quokkamole
Copy link

"Unable to create dest file /etc/nginx/conf.d/default.conf: rename /etc/nginx/conf.d/docker-gen"

I got this problem when launching (via docker-compose) from a shared folder on a windows host (linux guest in virtualbox) presumably due to associated file manipulation limitations as outlined above. Solution: run on the guest fs.

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

4 participants