buildx icon indicating copy to clipboard operation
buildx copied to clipboard

Provide option to allow access to /var/run/docker.sock during build

Open trajano opened this issue 11 months ago • 3 comments

Description

In order for tools like TestContainers to work inside a docker build it would need access to a docker daemon. I tried

RUN  --mount=type=bind,rw,source=/var/run/docker.sock,target=/var/run/docker.sock

to no avail, likely because I am on Windows. What I would propose is

RUN --mount=type=docker

Which will provide the /var/run/docker.sock during the run and will adapt to the current context. However, it can be extended to allow other contexts aside from the current.

RUN --mount=type=docker,context=anothercontext

rel: https://stackoverflow.com/questions/76842452/how-do-i-access-var-run-docker-sock-inside-docker-build

### Tasks
- [ ] Allow creating the bind mount and provide an example that shows TestContainers working for a simple local build
- [ ] Provide capability to handle alternate contexts.

trajano avatar Aug 05 '23 16:08 trajano