0

I am trying to configure my dockerd to inject an env var into all containers that it starts.

More specifically, I need every container to use SSH for it's DOCKER_HOST and also where that host is, so that containers don't try to volume mount the docker unix socket with -v /var/docker/docker.sock:/var/sock/docker.sock because that's a command that needs to be restricted

So, the general question (inject ANY env var to all containers) would be useful, but specifically, I need to inject the DOCKER_HOST, which might have a non generalized answer

0

1 Answer 1

0

To the best of my knowledge there is no native facility for injecting a set of default environment variables into all Docker containers; see Moby issue #16699 for some thoughts on exactly this question.

I guess if you were really ambitious, you could write a mutating proxy that sits in front of the docker socket and have it intercept the ContainerCreate operation, Update the Env key, and pass the request on to Docker.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .