-
Notifications
You must be signed in to change notification settings - Fork 245
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
small Dockerfile improvements #132
base: master
Are you sure you want to change the base?
Conversation
- build exact git tag instead of the current master - use scratch instead of an alpine runtime image - run container as user 1000 (not root) - change listening ports from system ports 53,80,443 to 5353,8080,8443
Thanks for the PR! This looks like a good update, I'm just slightly hesitant to merge it straight away because of the backwards breaking changes. I'll test it throughly in the near future to be able to figure out a good way to inform the current users about the changes they need to make. |
FYI, this PR should also include changes to |
Also, this fixes #79 |
Yes, for sure. I will add the change for the |
Ok, this PR looks good. I had to pick the Go base image line from this PR for the work done in #147 so there's a merge conflict for that line, I'm sorry. In addition to the merge conflict resolution, I think we should update the README to point to the new port configuration in: https://github.com/joohoi/acme-dns#using-docker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I stumbled upon two additional questions about the Dockerfile
Ping @schue30 are you interested to continue working on this PR or can someone else continue from here on? I would love to hear your opinion especially about the volume change, I'm not a Docker expert by any means myself. |
Pong @joohoi |
@@ -186,7 +188,32 @@ docker run --rm --name acmedns \ | |||
|
|||
3) Copy [docker-compose.yml from the project](https://raw.githubusercontent.com/joohoi/acme-dns/master/docker-compose.yml), or create your own. | |||
|
|||
4) Edit the `config/config.cfg` and `docker-compose.yml` to suit your needs, and run `docker-compose up -d`. | |||
4) Make sure that the user with id `1000` or group id `0` has read permissions on the configuration file in the `config` directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the user with ID 1000 is already an existing user on the host system for whom it wouldn't be appropriate to grant read permissions on that config file? Is there a way to configure the container to use a different user id for the process? Currently it's possible to do this in the existing acme-dns container by setting e.g. user: 1005:1005
in docker-compose.yml
. Would that cause any permission issues with the new container?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, changing away from 1000:1000 would cause problems. Anything "inside" the container would be owned by the wrong user ID.
If you're concerned about the host system, put your docker data under a directory only root can access. That way your host system user won't be able to access any of it. Docker runs as root and can find the correct directory for the mapping, but the host system user can't get to the subdirectory.
Regarding communication, normally I'd suggest a major version bump as a way of denoting that the changes could break stuff. In this case though it doesn't seem like there are any changes to acme-dns itself, just to the docker container. So I guess you could just bump the docker container version, but then it'd be out of sync with the acme-dns version. Hmm... |
I see that breaking changes stop this PR from being merged. There are ways to accomplish nearly the same without breaking changes.
// edit: fixed broken link. |
Hey folks, i've just implemented my self-hosted acme-dns instance into production using the modified version of the I don't want to create a PR yet as i see you are trying to solve similar docker image improvements here. My proposal is to use a multi stage docker build using the scratch as a final image. This has following features:
This solves all the previous implementation discussions that should be rather solved by outside of the project:
I think this can significantly your whole workflow. |
Root in scratch image is fine for my level of paranoia. Would make things much more simple. |
Use scratch as base image and only embed the static binary. Based on discussion joohoi#132 (comment)
Use scratch as base image and only embed the static binary. Based on discussion joohoi#132 (comment)
Use scratch as base image and only embed the static binary. Based on discussion joohoi#132 (comment)
This PR improves the following points in the Dockerfile:
WARNING - this PR contains breaking changes in the Dockerfile
The container that is started from the image that is built from this Dockerfile is running as user 1000 instead of root (0). As a non root user cannot (per default) listen on system ports (<1024), I had to change them to ones that are higher than 1024. In this case 5353, 8080.
Updates from older versions should not be a problem, as long as the user 1000 or the group 0 has read permissions on the config file, write permissions on the sqlite db file and the listening ports are higher than 1024.