Connecting to the local docker daemon using docker build (container in container)
- Dominant language
- C#
- Stars
- 2.4k
- Forks
- 416
- PR merge metrics
- No merged PRs in 30d
Description
I'm unable to connect to the local docker daemon when building a container using docker build on a Dockerfile.
1. Run: docker build -t myproj .
2. step inside Dockerfile: RUN dotnet test ./test.csproj
3. Code connects to client: unix:///var/run/docker.sock
4. Connection failed is returned
**Dockerfile:**
FROM microsoft/dotnet:2.2-sdk AS build-env
WORKDIR /app
COPY ./src ./
RUN dotnet restore ./myproj.Test/myproj.Test.csproj
RUN dotnet test ./myproj.Test/myproj.Test.csproj
**Connecting to the local daemon:**
` _client = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ?
new DockerClientConfiguration(new Uri("npipe://./pipe/docker_engine")).CreateClient() :
new DockerClientConfiguration(new Uri("unix:///var/run/docker.sock")).CreateClient();`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.