Short Version: How do I access the docker host from within a (windows server core) container on Windows?
Long Version: I’ve created an image based on microsoft/dotnet-framework-build:3.5 to install tools used during our CI/CD process.
During the build I install chocolatey and then, using choco, installer the docker CLI client. This is so I can push images, stored on the host, from within the container running (the build image), at least that was my hope.
The problem I have is that I cannot seem to bind the host
\\.\pipe\docker_engine to the pipe in the container. So far I’ve tried the following command line options (these start an interactive prompt for testing but the proper build will be non-interactive)
docker run --interactive --tty -v \\.\pipe\docker_engine:\\.\pipe\docker_engine my-image
In this case the container starts but the binding doesn’t work because when I run docker ps I get the error:
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.33/version: open //./pipe/docker_engine: message readmode pipes not supported In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
docker run --interactive --tty --mount type=bind,src=\\.\pipe\docker_engine,dst=\\.\pipe\docker_engine my-image
In this case the container won’t even start because I get the error:
Error response from daemon: invalid mount config for type "bind": source path must be a directory
How do I bind the \.\pipe\docker_engine so that the container can access the docker engine on the host?
The version info from my host install is:
Client: Version: 17.12.0-ce API version: 1.35 Go version: go1.9.2 Git commit: c97c6d6 Built: Wed Dec 27 20:05:22 2017 OS/Arch: windows/amd64 Server: Engine: Version: 17.12.0-ce API version: 1.35 (minimum version 1.24) Go version: go1.9.2 Git commit: c97c6d6 Built: Wed Dec 27 20:15:52 2017 OS/Arch: windows/amd64 Experimental: true
The client, inside the container, version info is
Client: Version: 17.10.0-ce API version: 1.33 Go version: go1.8.3 Git commit: f4ffd25 Built: Tue Oct 17 19:00:02 2017 OS/Arch: windows/amd64