podman icon indicating copy to clipboard operation
podman copied to clipboard

Docker Desktop cannot start if the docker_engine named pipe created by podman before it starts

Open fangpenlin opened this issue 3 years ago • 11 comments

Issue Description

I have both Docker Desktop and Podman Desktop installed on the same Windows PC. And from time to time, Docker desktop failed to start because the docker_engine named pipe has already been created by Podman:

image

I looked into the code

https://github.com/containers/podman/blob/72ec8824a0112e6ef1466afa95d7f4695aadac01/pkg/machine/wsl/machine.go#L1084-L1087

It seems like we are depending on whether there's a docker_engine named pipe already or not. But I guess the problem is, when will the Docker engine start, and when will the Podman engine start, there's no guarantee. If Docker starts first, the named pipe is taken, then it's all good. But if the Podman engine starts first, the name pipe is taken, then the Docker engine is going to fail.

Steps to reproduce the issue

Steps to reproduce the issue

  1. Install both Docker Desktop and Podman Desktop on the same PC
  2. Reboot a few time, or maybe find a way to adjust when the docker engine starts.
  3. As if podman engine starts first, you should see the same error

Describe the results you received

Docker engine failed to start

Describe the results you expected

Docker engine should be able to start regardless Podman Desktop installed or not. And there should be an option to disable the docker_engine named pipe for podman. Also, if we want to make this automatic, it shouldn't rely on the order of service start and the timing of named pipe acquisition. Maybe check Windows registry see if Docker installed or not instead?

podman info output

host:
  arch: amd64
  buildahVersion: 1.30.0
  cgroupControllers: []
  cgroupManager: cgroupfs
  cgroupVersion: v1
  conmon:
    package: conmon-2.1.7-2.fc37.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.7, commit: '
  cpuUtilization:
    idlePercent: 99.83
    systemPercent: 0.12
    userPercent: 0.05
  cpus: 32
  databaseBackend: boltdb
  distribution:
    distribution: fedora
    variant: container
    version: "37"
  eventLogger: journald
  hostname: MY-PC
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 524288
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 524288
      size: 65536
  kernel: 5.15.90.1-microsoft-standard-WSL2
  linkmode: dynamic
  logDriver: journald
  memFree: 14782373888
  memTotal: 16720412672
  networkBackend: netavark
  ociRuntime:
    name: crun
    package: crun-1.8.5-1.fc37.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.8.5
      commit: b6f80f766c9a89eb7b1440c0a70ab287434b17ed
      rundir: /run/user/1000/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  os: linux
  remoteSocket:
    exists: true
    path: /run/user/1000/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.0-8.fc37.x86_64
    version: |-
      slirp4netns version 1.2.0
      commit: 656041d45cfca7a4176f6b7eed9e4fe6c11e8383
      libslirp: 4.7.0
      SLIRP_CONFIG_VERSION_MAX: 4
      libseccomp: 2.5.3
  swapFree: 4294967296
  swapTotal: 4294967296
  uptime: 0h 48m 15.00s
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - docker.io
store:
  configFile: /home/user/.config/containers/storage.conf
  containerStore:
    number: 4
    paused: 0
    running: 0
    stopped: 4
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/user/.local/share/containers/storage
  graphRootAllocated: 1081101176832
  graphRootUsed: 1871233024
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 77
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/user/.local/share/containers/storage/volumes
version:
  APIVersion: 4.5.0
  Built: 1681486976
  BuiltTime: Fri Apr 14 08:42:56 2023
  GitCommit: ""
  GoVersion: go1.19.7
  Os: linux
  OsArch: linux/amd64
  Version: 4.5.0


### Podman in a container

No

### Privileged Or Rootless

None

### Upstream Latest Release

Yes

### Additional environment details

Additional environment details

### Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

fangpenlin avatar Jul 13 '23 20:07 fangpenlin

Podman should not be listening on the docker socket unless it is configured to in Podman Desktop. @n1hility PTAL

rhatdan avatar Jul 13 '23 20:07 rhatdan

While on Mac we require a helper to be installed which indirectly acts as an enable / disable (with a notification on machine start to do so if not installed), on Windows it just happens as part of machine start. I agree we should add an option to disable/enable it, which desktop can call as part of compatibilty mode.

It seems like we are depending on whether there's a docker_engine named pipe already or not. But I guess the problem is, when will the Docker engine start, and when will the Podman engine start, there's no guarantee. If Docker starts first, the named pipe is taken, then it's all good. But if the Podman engine starts first, the name pipe is taken, then the Docker engine is going to fail.

The detection and backoff in the Windows case isn't there to coordinate between the two, its just to allow the machine start to fallback inform the user of the location to set DOCKER_HOST (as part of a CLI start) when the global default is not available.

n1hility avatar Jul 13 '23 20:07 n1hility

/assign

n1hility avatar Jul 13 '23 20:07 n1hility

After shutting down Podman machine and Podman Desktop still seeing the same error

image

It turns out win-sshproxy.exe is still running and holding a handle to the named pipe, and that's probably why I see an access denied error. After killing the ssh proxy process, now my docker can start normally.

FYI for people who run into the same issue, a temporary solution is to:

  1. Shutdown podman machine & desktop
  2. Kill all win-sshproxy.exe which still holds a handle to the docker_engine named pipe (you can find it from Resource Monitor)
  3. Start Docker desktop and it should works normally
  4. Start Podman machine & desktop and it should works normally

fangpenlin avatar Jul 13 '23 20:07 fangpenlin

It turns out win-sshproxy.exe is still running and holding a handle to the named pipe, and that's probably why I see an access denied error. After killing the ssh proxy process, now my docker can start normally.

ah, Any chance you manually killed the podman machine (e.g. via a wsl --terminate or sending a kill to a wsl process)? A normal clean shutdown (podman machine stop) should stop the win-sshproxy process.

n1hility avatar Jul 13 '23 21:07 n1hility

I recall I saw some error message when running podman machine stop. Forgot what I saw, but it seems like the shutdown process wasn't done successfully, maybe that's why the ssh proxy was stilling running. If I can find some time may try again later today see if I can see what's the error I saw.

fangpenlin avatar Jul 13 '23 21:07 fangpenlin

I recall I saw some error message when running podman machine stop. Forgot what I saw, but it seems like the shutdown process wasn't done successfully, maybe that's why the ssh proxy was stilling running. If I can find some time may try again later today see if I can see what's the error I saw.

ah yes that would do it. thanks for offering to report back, if you happen to see that again would be curious what you saw.

n1hility avatar Jul 13 '23 21:07 n1hility

okay, I just rebooted and ran into the same problem

Looks like machine stop shows it's stopped successfully. But somehow the win-sshproxy.exe process is still there and holding the docker_engine name pipe

image

fangpenlin avatar Jul 18 '23 19:07 fangpenlin

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Aug 18 '23 00:08 github-actions[bot]

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Sep 19 '23 00:09 github-actions[bot]

This is still a problem.

bme-cgm avatar Jul 09 '26 12:07 bme-cgm