-
Notifications
You must be signed in to change notification settings - Fork 604
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
Adding Docker Opts to entrypoint #20
Conversation
Allowing docker opts in entry point to pass arguments to the daemon via ENV Vars
I am not sure what is gained with this change. If you really want to set an environment variable with your docker options, this would be equivalent: $ docker run --privileged --name some-docker -d docker:1.8-dind $DOCKER_OPTS
# vs, new change:
$ docker run --privileged --name some-docker -d -e DOCKER_OPTS docker:1.8-dind I feel like any extra flag options to the docker daemon should be explicit rather than inferred. |
@yosifkit thanks for the feedback - I was having trouble getting |
After a quick test - I could not get To reproduce: $> docker run --name dind_run --rm -it --privileged -e DOCKER_OPTS="--insecure-registry <some_insecure_reg:port>" docker:1.12-dind
$> docker exec -it dind_run
#> docker pull <some_insecure_reg:port>/something
Error response from daemon: Get https://<...>/v1/_ping: x509: cannot validate certificate for <...> because it doesn't contain any IP SANs The following works $> docker run --name other_run --rm -it --privileged docker:1.12-dind --insecure-registry <insec_reg:port>
$> docker exec -it other_run sh
#> docker pull <some_insecure_reg:port>/something |
Right, what @yosifkit was pointing out is that If it's that you've got a local $ docker run ... docker:dind $DOCKER_OPTS
... (which has your local shell do the expansion instead of relying on the image to expand) On the other hand, if the use case is docker:
image: docker:dind
restart: always
tty: true
privileged: true
command: [
'--log-level', 'debug',
'--storage-driver', 'overlay',
'--cluster-store', 'consul://cluster-store:8500',
'--cluster-advertise', 'eth0:2375',
] (or any other supported YAML syntax for an array) If you absolutely need to be able to provide an environment variable, then changing the default command to something like the following should do the trick: $ docker run ... -e DOCKER_OPTS='...' docker:dind sh -c 'exec dockerd-entrypoint.sh $DOCKER_OPTS'
... |
Thanks for the info @tianon - Sorry about that confusion. So unfortunately my PR is due to a limitation on some other software I've been using mainly GitLab CI. The DSL allows you to provide "services" as dependencies to the builds (in my case DinD) but it does not allow for providing CMD args, or anything outside of Environment Variables. |
Ahh, then you probably want to read the discussion in #12. |
Looks like my PR is a duplicate of #12! Sorry about that! - The conversation makes sense to me. I'll see what it might take to extend the GitLab stuff. Thanks again for the feedback! |
Allowing docker opts in entry point to pass arguments to the daemon via environment variables as well as CMD arguments.