containers / podman

Podman: A tool for managing OCI containers and pods.
https://podman.io
Apache License 2.0
23.83k stars 2.42k forks source link

podman-mac-helper can't remove docker.sock #20650

Closed tnk4on closed 9 months ago

tnk4on commented 1 year ago

Issue Description

Enabled podman-mac-helper and created a symbolic link to docker.sock. After that, disabling podman-mac-helper does not delete the created docker.sock symlink.

Steps to reproduce the issue

Steps to reproduce the issue

% sudo podman-mac-helper install
% sudo launchctl list | grep com.github.containers.podman.helper-shtanaka
-   0   com.github.containers.podman.helper-shtanaka
% ls -l /var/run/docker.sock
ls: /var/run/docker.sock: No such file or directory
% podman machine stop; podman machine start
% ls -l /var/run/docker.sock
lrwxr-xr-x@ 1 root  daemon  66 11 10 22:20 /var/run/docker.sock -> /Users/shtanaka/.local/share/containers/podman/machine/podman.sock
% sudo podman-mac-helper uninstall
% sudo launchctl list | grep com.github.containers.podman.helper-shtanaka
% podman machine stop; podman machine start
% ls -l /var/run/docker.sock
lrwxr-xr-x@ 1 root  daemon  66 11 10 22:20 /var/run/docker.sock -> /Users/shtanaka/.local/share/containers/podman/machine/podman.sock

Describe the results you received

% ls -l /var/run/docker.sock
lrwxr-xr-x@ 1 root  daemon  66 11 10 22:20 /var/run/docker.sock -> /Users/shtanaka/.local/share/containers/podman/machine/podman.sock

Describe the results you expected

% ls -l /var/run/docker.sock
ls: /var/run/docker.sock: No such file or directory

podman info output

% podman version
Client:       Podman Engine
Version:      4.7.2
API Version:  4.7.2
Go Version:   go1.21.3
Git Commit:   750b4c3a7c31f6573350f0b3f1b787f26e0fe1e3
Built:        Tue Oct 31 20:59:17 2023
OS/Arch:      darwin/arm64

Server:       Podman Engine
Version:      4.7.0
API Version:  4.7.0
Go Version:   go1.20.8
Built:        Thu Sep 28 03:24:25 2023
OS/Arch:      linux/arm64

% podman info
host:
  arch: arm64
  buildahVersion: 1.32.0
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - pids
  - rdma
  - misc
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.7-2.fc38.aarch64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.7, commit: '
  cpuUtilization:
    idlePercent: 99.14
    systemPercent: 0.61
    userPercent: 0.25
  cpus: 10
  databaseBackend: boltdb
  distribution:
    distribution: fedora
    variant: coreos
    version: "38"
  eventLogger: journald
  freeLocks: 2037
  hostname: localhost.localdomain
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 6.5.7-200.fc38.aarch64
  linkmode: dynamic
  logDriver: journald
  memFree: 49543278592
  memTotal: 50405285888
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.8.0-1.fc38.aarch64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.8.0
    package: netavark-1.8.0-2.fc38.aarch64
    path: /usr/libexec/podman/netavark
    version: netavark 1.8.0
  ociRuntime:
    name: crun
    package: crun-1.9.2-1.fc38.aarch64
    path: /usr/bin/crun
    version: |-
      crun version 1.9.2
      commit: 35274d346d2e9ffeacb22cc11590b0266a23d634
      rundir: /run/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-0^20231004.gf851084-1.fc38.aarch64
    version: |
      pasta 0^20231004.gf851084-1.fc38.aarch64-pasta
      Copyright Red Hat
      GNU General Public License, version 2 or later
        <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
  remoteSocket:
    exists: true
    path: /run/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: false
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.1-1.fc38.aarch64
    version: |-
      slirp4netns version 1.2.1
      commit: 09e31e92fa3d2a1d3ca261adaeb012c8d75a8194
      libslirp: 4.7.0
      SLIRP_CONFIG_VERSION_MAX: 4
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 0h 2m 25.00s
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - docker.io
store:
  configFile: /usr/share/containers/storage.conf
  containerStore:
    number: 4
    paused: 0
    running: 0
    stopped: 4
  graphDriverName: overlay
  graphOptions:
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphRootAllocated: 106769133568
  graphRootUsed: 29181771776
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Supports shifting: "true"
    Supports volatile: "true"
    Using metacopy: "true"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 43
  runRoot: /run/containers/storage
  transientStore: false
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 4.7.0
  Built: 1695839065
  BuiltTime: Thu Sep 28 03:24:25 2023
  GitCommit: ""
  GoVersion: go1.20.8
  Os: linux
  OsArch: linux/arm64
  Version: 4.7.0

Podman in a container

No

Privileged Or Rootless

None

Upstream Latest Release

Yes

Additional environment details

% sw_vers
ProductName:        macOS
ProductVersion:     13.6.1
BuildVersion:       22G313

Additional information

Because of this issue, the Docker Compatibility behavior of Podman Desktop is mismatched with the podman-mac-helper state. Screenshot 2023-11-10 at 22 26 04

delboy1978uk commented 1 year ago

Why not just set the environment variable DOCKER_HOST=unix:///path/to/your/podman.sock instead of symlinking?

tnk4on commented 1 year ago

Yes, using the DOCKER_HOST environment variable definitely works. The issue here is that the behavior of podman-mac-helper as a standard bundled tool for Podman in macOS is not consistent.

delboy1978uk commented 1 year ago

ah ok i get you, so either yes the helper has to delete the symlink which it created, or refactor to use the (more sane option imho) environment var