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

No ability to import more config files #7

Open
naveci opened this issue Feb 7, 2018 · 4 comments
Open

No ability to import more config files #7

naveci opened this issue Feb 7, 2018 · 4 comments

Comments

@naveci
Copy link

naveci commented Feb 7, 2018

Hey,

Great project. I really enjoy the container, but I've been unable so far to add extra hostfiles. By simple redirecting the whole directory (instead of only the config file) breaks everything. And so does every other solution I've tried.

My goal is to have auto-updating DNS blocking lists which I update on the host and are linked in the Docker container. https://github.com/notracking/hosts-blocklists is a good example of such a list. It takes some of the performance hit away from my firewall.

Kind regards

@jpillora
Copy link
Owner

jpillora commented Feb 7, 2018

I've never tried it, though does mounting a new hosts file work:

  -v /opt/hosts:/etc/hosts

?

@naveci
Copy link
Author

naveci commented Feb 10, 2018

Sadly no, I get an error that happens more often when I've tried to connect a directory:

Recreating dnsmasq ... error

ERROR: for dnsmasq  Cannot start service dnsmasq: OCI runtime create failed: container_linux.go:296: starting container process caused "process_linux.go:398: container init caused \"rootfs_linux.go:58: mounting \\\"/opt/hosts\\\" to rootfs \\\"/var/lib/docker/overlay/773eb0e23d3f27f4a637a917ee275f8400355ea9e521b0f8486c27c43b21a1fc/merged\\\" at \\\"/var/lib/docker/overlay/773eb0e23d3f27f4a637a917ee275f8400355ea9e521b0f8486c27c43b21a1fc/merged/etc/hosts\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

ERROR: for dnsmasq  Cannot start service dnsmasq: OCI runtime create failed: container_linux.go:296: starting container process caused "process_linux.go:398: container init caused \"rootfs_linux.go:58: mounting \\\"/opt/hosts\\\" to rootfs \\\"/var/lib/docker/overlay/773eb0e23d3f27f4a637a917ee275f8400355ea9e521b0f8486c27c43b21a1fc/merged\\\" at \\\"/var/lib/docker/overlay/773eb0e23d3f27f4a637a917ee275f8400355ea9e521b0f8486c27c43b21a1fc/merged/etc/hosts\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: Encountered errors while bringing up the project.

OS = CentOS.
Problem only occurs with this container, so I'm not sure whether it has to do with the Dockerfile or something else is at play.

@FlyingEagle
Copy link

Is there a Solution?

@franciswertz
Copy link

I added in blacklisting by doing the following:

  1. Add directory config directive to the dnsmasq.conf:
conf-dir=/etc/dnsmasq.d/
  1. Add a volume mapping for this directory. In my case my home container server this is located at /opt/dnsmasq/
-v /opt/dnsmasq/conf.d:/etc/dnsmasq.d/
  1. Add a blacklisit.conf. I generated mine from https://pgl.yoyo.org/as/

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