Compose: [Windows] Does not connect using mounted npipe within a windows container

Created on 21 Aug 2019  Â·  8Comments  Â·  Source: docker/compose

Description of the issue

docker-compose cant connect to a mounted named pipe within a windows container. The windows container is started with docker run --rm -it -v \\.\pipe\docker_engine:\\.\pipe\docker_engine mariotoffia/dockercliremotetest:latest and then run docker-compose up within the windows container (mariotoffia/dockercliremotetest).

This it to try to resolve a Issue reported on my little open source project FluentDocker

Context information (for bug reports)

Output of docker-compose version

docker-compose version 1.24.1, build 4667896b
docker-py version: 3.7.3
CPython version: 3.6.8
OpenSSL version: OpenSSL 1.0.2q  20 Nov 2018

Output of docker version

Client: Docker Engine - Enterprise
 Version:           19.03.1
 API version:       1.40
 Go version:        go1.12.5
 Git commit:        f660560464
 Built:             07/25/2019 20:59:52
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.1
  API version:      1.40 (minimum version 1.24)
  Go version:       go1.12.5
  Git commit:       74b1e89
  Built:            Thu Jul 25 21:25:07 2019
  OS/Arch:          windows/amd64
  Experimental:     false

Output of docker-compose config
(Make sure to add the relevant -f and other flags)

version: '3.4'

services:
  dockercliremotetest:
    image: hello-world

Steps to reproduce the issue

  1. Build and run the container as described in _Additional Information_
  2. run docker-compose -verbose up (with or without -H npipe:////./pipe/docker_engine)

Observed result

docker-compose -H npipe:////./pipe/docker_engine --verbose up

I get the following error output (without --verbose):

ERROR: Couldn't connect to Docker daemon. You might need to start Docker for Windows.

Expected result

Fire up the _hello-world_ container as per docker-compose.yml:

version: '3.4'

services:
  dockercliremotetest:
    image: hello-world

Stacktrace / full error message

ompose.config.config.find: Using configuration files: .\docker-compose.yml
docker.utils.config.find_config_file: Trying paths: ['C:\\Users\\ContainerAdministrator\\.docker\\config.json', 'C:\\Users\\ContainerAdministrator\\.dockercfg']
docker.utils.config.find_config_file: No config file found
docker.utils.config.find_config_file: Trying paths: ['C:\\Users\\ContainerAdministrator\\.docker\\config.json', 'C:\\Users\\ContainerAdministrator\\.dockercfg']
docker.utils.config.find_config_file: No config file found
Traceback (most recent call last):
  File "compose\cli\main.py", line 71, in main
  File "compose\cli\main.py", line 124, in perform_command
  File "compose\cli\command.py", line 42, in project_from_options
  File "compose\cli\command.py", line 123, in get_project
  File "compose\cli\command.py", line 97, in get_client
  File "site-packages\docker\api\daemon.py", line 181, in version
  File "site-packages\docker\utils\decorators.py", line 46, in inner
  File "site-packages\docker\api\client.py", line 230, in _get
  File "site-packages\requests\sessions.py", line 537, in get
  File "site-packages\requests\sessions.py", line 524, in request
  File "site-packages\requests\sessions.py", line 637, in send
  File "site-packages\requests\adapters.py", line 449, in send
  File "site-packages\urllib3\connectionpool.py", line 600, in urlopen
  File "site-packages\urllib3\connectionpool.py", line 354, in _make_request
  File "http\client.py", line 1239, in request
  File "http\client.py", line 1285, in _send_request
  File "http\client.py", line 1234, in endheaders
  File "http\client.py", line 1026, in _send_output
  File "http\client.py", line 964, in send
  File "site-packages\docker\transport\npipeconn.py", line 32, in connect
  File "site-packages\docker\transport\npipesocket.py", line 22, in wrapped
  File "site-packages\docker\transport\npipesocket.py", line 50, in connect
  File "docker-compose", line 6, in <module>
  File "compose\cli\main.py", line 71, in main
  File "compose\cli\main.py", line 124, in perform_command
  File "compose\cli\command.py", line 42, in project_from_options
  File "compose\cli\command.py", line 123, in get_project
  File "compose\cli\command.py", line 97, in get_client
  File "site-packages\docker\api\daemon.py", line 181, in version
  File "site-packages\docker\utils\decorators.py", line 46, in inner
  File "site-packages\docker\api\client.py", line 230, in _get
  File "site-packages\requests\sessions.py", line 537, in get
  File "site-packages\requests\sessions.py", line 524, in request
  File "site-packages\requests\sessions.py", line 637, in send
  File "site-packages\requests\adapters.py", line 449, in send
  File "site-packages\urllib3\connectionpool.py", line 600, in urlopen
  File "site-packages\urllib3\connectionpool.py", line 354, in _make_request
  File "http\client.py", line 1239, in request
  File "http\client.py", line 1285, in _send_request
  File "http\client.py", line 1234, in endheaders
  File "http\client.py", line 1026, in _send_output
  File "http\client.py", line 964, in send
  File "site-packages\docker\transport\npipeconn.py", line 32, in connect
  File "site-packages\docker\transport\npipesocket.py", line 22, in wrapped
  File "site-packages\docker\transport\npipesocket.py", line 50, in connect
pywintypes.error: (2, 'WaitNamedPipe', 'The system cannot find the file specified.')
[592] Failed to execute script docker-compose

Additional information

Using the following file to build a windows container with docker-compose and add sample _docker-compose.yaml_ file.

FROM mcr.microsoft.com/windows/servercore:ltsc2019 AS base
WORKDIR /src
USER ContainerAdministrator 
# Install Dotnet
ENV DOTNET_SDK_VERSION 2.1.403
RUN powershell Invoke-WebRequest -OutFile dotnet.zip https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$Env:DOTNET_SDK_VERSION/dotnet-sdk-$Env:DOTNET_SDK_VERSION-win-x64.zip
RUN powershell Expand-Archive dotnet.zip -DestinationPath 'C:\Program Files\dotnet'
RUN powershell Remove-Item -Force dotnet.zip
RUN setx /M PATH "%PATH%;C:\Program Files\dotnet"
# Install Nuget and Docker
RUN powershell Invoke-WebRequest "https://raw.githubusercontent.com/mariotoffia/stuff/master/docker-install.ps1" -UseBasicParsing -OutFile C:\Users\ContainerAdministrator\AppData\Local\Temp\docker-install.ps1; exit 0
RUN powershell C:\Users\ContainerAdministrator\AppData\Local\Temp\docker-install.ps1; exit 0
# Install Docker Compose
RUN powershell [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; exit 0
RUN powershell Invoke-WebRequest "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-Windows-x86_64.exe" -UseBasicParsing -OutFile $Env:ProgramFiles\Docker\docker-compose.exe
# Download sample docker-compose.yml
RUN powershell Invoke-WebRequest "https://raw.githubusercontent.com/mariotoffia/stuff/master/docker-compose.yml" -UseBasicParsing -OutFile C:\Src\docker-compose.yml; exit 0

ENTRYPOINT ["powershell.exe"]
  • Build it using docker build --no-cache --force-rm -t mariotoffia/dockercliremotetest .
  • Run it using docker run --rm -it -v \\.\pipe\docker_engine:\\.\pipe\docker_engine mariotoffia/dockercliremotetest:latest

OS version / distribution, docker-compose install method, etc.

stale

Most helpful comment

By looking at the stack trace it looks like this is tied to the open issue in https://github.com/docker/docker-py/issues/2018

This issue is a duplicate of https://github.com/docker/compose/issues/5934

All 8 comments

Is there nobody that have encountered this issue?

I've found the exact same issue with the same versions you have

Same behavior on windows 10 and windows server 2019.

Did you find a workaround?

@romerod Sorry no, but if you do I'm gladly takes your advice how to workaround this issue.

Is there someone from docker-compose team who can look at this issue? @GordonTheTurtle

By looking at the stack trace it looks like this is tied to the open issue in https://github.com/docker/docker-py/issues/2018

This issue is a duplicate of https://github.com/docker/compose/issues/5934

Thanks @romerod @mariotoffia, the PR is merged, this fix will be available in the next compose release.

Thanks that's very cool

Holen Sie sich Outlook für Androidhttps://aka.ms/ghei36


From: Djordje Lukic notifications@github.com
Sent: Wednesday, November 6, 2019 9:44:11 AM
To: docker/compose compose@noreply.github.com
Cc: Daniel Romero daniel.romero@baseclass.ch; Mention mention@noreply.github.com
Subject: Re: [docker/compose] [Windows] Does not connect using mounted npipe within a windows container (#6860)

Thanks @romerodhttps://github.com/romerod @mariotoffiahttps://github.com/mariotoffia, the PR is merged, this fix will be available in the next compose release.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/docker/compose/issues/6860?email_source=notifications&email_token=AAYQTXT4B3G23GFI7NNGH33QSJ7VXA5CNFSM4IOCT6I2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDFXWRQ#issuecomment-550206278, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAYQTXR6XYPVSXGCBCVFELLQSJ7VXANCNFSM4IOCT6IQ.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings