Skip to content

Windows: remote docker context via SSH fails on Windows #8000

@LUC18fknU7P

Description

@LUC18fknU7P

Description of the issue

I made an issue about this on the docker-py repo: docker/docker-py#2723
#7872 and docker/docker-py#2691 has an unintended bug where it uses preexec_fn which isn't supported on Windows.
workaround is to define COMPOSE_PARAMIKO_SSH env var as 1 but will also cause the problems that were intended to be fixed by that PR.

Context information (for bug reports)

Output of docker-compose version

docker-compose version 1.28.0-rc1, build 1f469474
docker-py version: 4.4.0
CPython version: 3.9.0
OpenSSL version: OpenSSL 1.1.1g  21 Apr 2020

Output of docker version

Client:
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.12
 Git commit:        0ed913b8-
 Built:             07/28/2020 16:36:03
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.14
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       5eb3275d40
  Built:            Tue Dec  1 19:18:53 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.3.9
  GitCommit:        ea765aba0d05254012b0b9e595e995c09186427f
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

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

services:
  vscode-container:
    build:
      args:
        VARIANT: '1'
      #redacted absolute path for bug report
      context: .
      dockerfile: Dockerfile
      target: run-stage
    cap_add:
    - SYS_PTRACE
    command: /bin/sh -c "while sleep 1000; do :; done"
    ports:
    - published: 9000
      target: 9000
    security_opt:
    - seccomp:unconfined
    volumes:
    #redacted absolute path for bug report
    - .:/workspace:cached 
version: '3.8'

Steps to reproduce the issue

  1. Use Windows with docker-cli and docker-compose installed.
  2. Use SSH for context with a Linux host and set as default. e.g ssh://user@host:22
  3. Use public & private key authentication instead of passwords (Not sure if applies but that's what I'm using) and add it to ssh-agent
  4. make sure that env COMPOSE_PARAMIKO_SSH is 0 and try ex. docker-compose ps

Observed result

The stacktrace below

Expected result

Name   Command   State   Ports
------------------------------

Stacktrace / full error message

Traceback (most recent call last):
  File "docker\api\client.py", line 214, in _retrieve_server_version
  File "docker\api\daemon.py", line 181, in version
  File "docker\utils\decorators.py", line 46, in inner
  File "docker\api\client.py", line 237, in _get
  File "requests\sessions.py", line 543, in get
  File "requests\sessions.py", line 530, in request
  File "requests\sessions.py", line 643, in send
  File "requests\adapters.py", line 439, in send
  File "urllib3\connectionpool.py", line 670, in urlopen
  File "urllib3\connectionpool.py", line 392, in _make_request
  File "http\client.py", line 1255, in request
  File "http\client.py", line 1301, in _send_request
  File "http\client.py", line 1250, in endheaders
  File "http\client.py", line 1010, in _send_output
  File "http\client.py", line 950, in send
  File "docker\transport\sshconn.py", line 105, in connect
  File "docker\transport\sshconn.py", line 45, in connect
  File "subprocess.py", line 778, in __init__
ValueError: preexec_fn is not supported on Windows platforms

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose\cli\main.py", line 68, in main
  File "compose\cli\main.py", line 124, in perform_command
  File "compose\cli\command.py", line 60, in project_from_options
  File "compose\cli\command.py", line 152, in get_project
  File "compose\cli\docker_client.py", line 41, in get_client
  File "compose\cli\docker_client.py", line 170, in docker_client
  File "docker\api\client.py", line 197, in __init__
  File "docker\api\client.py", line 221, in _retrieve_server_version
docker.errors.DockerException: Error while fetching server API version: preexec_fn is not supported on Windows platforms
[580] Failed to execute script docker-compose

Additional information

OS version / distribution, docker-compose install method, etc.
Windows 10 2004 Build 19041.630
install method: choco install docker-compose (manually replaced the file with the prerelease one)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions