docker / docker/buildx

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

Open
#1,991 8 comments 22 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/enhancement status/triage
Dominant language
Go
Stars
4.5k
Forks
682
Avg merge
2d 14h
Merged PRs (30d)
29

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Start by reproducing the proposed Dockerfile mount behavior and reviewing how buildx handles existing mount types. Done means allowing a docker daemon mount for local builds, documenting a working TestContainers example, and addressing alternate Docker contexts.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, dockerfile, go
Domain
build-system, cli, devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.