desktop-linux icon indicating copy to clipboard operation
desktop-linux copied to clipboard

com.docker.backend: Allow specifying runtime directory to enable packaging on NixOS Linux

Open teutat3s opened this issue 2 years ago • 4 comments

While trying to package Linux docker-desktop for NixOS, a linux distro which does not work with FHS, it seems I came across a hard-coded path to /opt/docker-desktop/componentsVersion.json which blocks me from running docker-desktop in its currently released version 4.10.1.

Suggestions for possible solutions:

  • add a CLI flag to com.docker.backend that allows specifying the runtime / current working directory
  • try to auto-detect the current working directory and read files from there

The systemd unit file itself can be patched in the packaging process to adjust for the different paths, e.g. for the current version it looks like this:

❯ systemctl --user cat docker-desktop
# /run/current-system/sw/share/systemd/user/docker-desktop.service
[Unit]
Description=Docker Desktop
Requires=graphical-session.target
After=graphical-session.target

[Service]
ExecStart=/nix/store/sdf8lrbhjwlg3fkp8ykdb0lj6p2psnvi-docker-desktop-4.10.1/lib/docker-desktop/bin/com.docker.backend --with-frontend
Type=exec
TimeoutSec=60

[Install]
Alias=docker-desktop.service
WantedBy=graphical-session.target

Logs from the systemd service, failing to start:

❯ journalctl --user -u docker-desktop --output=short-iso --no-hostname --no-pager
2022-07-28T12:18:04+0200 systemd[2423]: Starting Docker Desktop...
2022-07-28T12:18:04+0200 systemd[2423]: Started Docker Desktop.
2022-07-28T12:18:04+0200 com.docker.backend[230998]: 2022/07/28 12:18:04 notifying bugsnag: unmarshalling components version: open /opt/docker-desktop/componentsVersion.json: no such file or directory
2022-07-28T12:18:04+0200 com.docker.backend[231028]: [2022-07-28T10:18:04.211336662Z][com.docker.backend][I] set path configuration to OnHost
2022-07-28T12:18:04+0200 com.docker.backend[231028]: [2022-07-28T10:18:04.561289250Z][com.docker.backend][E] unmarshalling components version: open /opt/docker-desktop/componentsVersion.json: no such file or directory
2022-07-28T12:18:04+0200 com.docker.backend[231028]: [main.main()
2022-07-28T12:18:04+0200 com.docker.backend[231028]: [        common/cmd/com.docker.backend/main.go:96 +0x85
2022-07-28T12:18:04+0200 systemd[2423]: docker-desktop.service: Main process exited, code=exited, status=3/NOTIMPLEMENTED
2022-07-28T12:18:04+0200 systemd[2423]: docker-desktop.service: Killing process 231043 (com.docker.back) with signal SIGKILL.
2022-07-28T12:18:04+0200 systemd[2423]: docker-desktop.service: Failed with result 'exit-code'.

As you saw above, in the NixOS distro, the path to the com.docker.backend binary looks like this:

/nix/store/sdf8lrbhjwlg3fkp8ykdb0lj6p2psnvi-docker-desktop-4.10.1/lib/docker-desktop/bin/com.docker.backend

and the missing file componentsVersion.json is there, too:

❯ cat /nix/store/sdf8lrbhjwlg3fkp8ykdb0lj6p2psnvi-docker-desktop-4.10.1/lib/docker-desktop/componentsVersion.json
{
  "Version": "4.10.1",
  "BuildNumber": "82475",
  "sha1": "67677f2a11fd6effa728c4c95627e00e60dd90d9",
  "ComposeVersion": "1.29.2",
  "Compose2Version": "v2.6.1",
  "CredentialHelpersVersion": "v0.6.4",
  "EngineVersion": "20.10.17",
  "CliVersion": "20.10.17",
  "ComposeCliVersion": "v1.0.24",
  "KubernetesVersion": "v1.24.1",
  "SnykVersion": "v1.827.0",
  "LinuxVersion": "docker/for-desktop-kernel:5.10.104-ad41e9402fa6e51d2635fb92e4cb6b90107caa25",
  "Channel": "main"
}

teutat3s avatar Aug 02 '22 11:08 teutat3s

There hasn't been any activity on this issue for a long time. If the problem is still relevant, mark the issue as fresh with a /remove-lifecycle stale comment. If not, this issue will be closed in 30 days.

Prevent issues from auto-closing with a /lifecycle frozen comment.

/lifecycle stale

docker-robott avatar Feb 28 '23 01:02 docker-robott

/remove-lifecycle stale

teutat3s avatar Feb 28 '23 02:02 teutat3s

There hasn't been any activity on this issue for a long time. If the problem is still relevant, mark the issue as fresh with a /remove-lifecycle stale comment. If not, this issue will be closed in 30 days.

Prevent issues from auto-closing with a /lifecycle frozen comment.

/lifecycle stale

docker-robot[bot] avatar Jun 23 '23 01:06 docker-robot[bot]

/remove-lifecycle stale

teutat3s avatar Jul 02 '23 09:07 teutat3s