← Back to issue list

Snapcraft is no longer working within a Docker container

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1956216
Type
issue
State
closed
Author
~mhoeher
Labels
—
Created
Updated
Closed

Current evaluation

Reporter's own PR snapcore/snapcraft#3607 (branch launchpad-bug-1956216) fixed the Docker breakage by correcting the Python install/PATH and site-packages, merged as 808d3b399 (commit 6f2dc4445 "docker: fix python installation").

Resolution: closed resolved

Reason: The reporter diagnosed the regression and submitted upstream PR snapcore/snapcraft#3607, which was merged into the main branch (merge commits 808d3b399 and fe185e8df, containing 6f2dc4445 'docker: fix python installation'), and the Launchpad bug was closed. Maintainers also noted snapcraft 5.0 remained a workaround for Docker users.

Evaluated by: mr-cal-bot

No scores available.

Issue body

For building my app as a snap, I used to have a Docker image which I can use in my CI/CD pipelines. I maintain a repository to build the image on GitLab: https://gitlab.com/rpdev/docker/snapcraft The resulting Docker image is used in this project: https://gitlab.com/rpdev/opentodolist Initially, this worked quite fine and allowed immediate feedback when the Snap build would ever break. However, some weeks ago something must have changed upstream. I first thought that maybe my Dockerfile had an issue, so I migrated it to the "official" one from here: https://github.com/snapcore/snapcraft/tree/master/docker However, with both the upstream Dockerfile as well as my own one (which basically is inspired by the upstream one) I get the following error when running snapcraft within the container later on in the CI/CD pipelines (e.g. in this job -> https://gitlab.com/rpdev/opentodolist/-/jobs/1934812717): $ snapcraft snap Traceback (most recent call last): File "/snap/snapcraft/current/bin/snapcraft", line 5, in <module> from snapcraft.cli.__main__ import run ModuleNotFoundError: No module named 'snapcraft' I tried to look for a possible solution and found the following forum post: https://forum.snapcraft.io/t/snapcraft-failed-in-container/27921/2 I applied the suggested patch in the Dockerfile, but still get the same error. So it seems to me something changed upstream and completely broke using snapcraft within docker. Doing some further research, I think I am not the only one affected, see e.g. this issue on GitHub: https://github.com/cibuilds/snapcraft/issues/36 It would be really great if this could be fixed (because IMAO it is better to have the possibility to integrate the snap build directly with my project pipelines) or if this change is intentional, it should at least be properly documented (I think, it should be reflected here: https://snapcraft.io/docs/build-on-docker). Thanks for considering!

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Reporter's own PR snapcore/snapcraft#3607 (branch launchpad-bug-1956216) fixed the Docker breakage by correcting the Python install/PATH and site-packages, merged as 808d3b399 (commit 6f2dc4445 "docker: fix python installation").
stealth/space-bunny-alpha — closed resolved Fixed Docker support by correcting Python PATH/symlinks and adding a site-packages .pth file in merged PR #3607 (commit 6f2dc4445).
stealth/space-bunny-alpha — closed stale Closed without a documented resolution. Commit 6f2dc4445 fixed Docker’s Python installation, but no evidence links that commit to this report.
qwen/qwen3.6-35b-a3b — — Closed without resolution or comments. The snapcraft Docker container build failure remains unfixed, indicating the report was abandoned due to inactivity.
qwen/qwen3.6-35b-a3b — — Closed without resolution. The report detailed a snapcraft ModuleNotFoundError in Docker containers, but received no comments or fixes. The issue remains abandoned.
qwen/qwen3.6-35b-a3b — — Closed without resolution. The reported snapcraft Docker container build failure remains unresolved, likely abandoned or superseded by upstream changes.
qwen3.6-35b-a3b-mtp-q6 — — Closed and abandoned without resolution or comments. The reported snapcraft Docker container failure remains unaddressed, likely superseded by upstream changes.

Update history

Date Change
created

Related work

  • Likely Fixed By: snapcore/snapcraft#3607 (confidence 97%)

    Reporter-authored PR, branch named 'launchpad-bug-1956216', merged as 808d3b399/fe185e8df fixing the Python site-packages/PATH in the Docker image

  • Superseded By: snapcore/snapcraft#4109 (confidence 60%)

    Commit eb0bf1276 'docker: remove outdated Dockerfile (#4109)' later removed the official Dockerfile the fix touched, replacing it with the snapcraft-rocks registry

Related issues

Issue Project State Summary Similarity
#3607 Launchpad bug 1956216: Fix Python installation snapcraft merged Merged PR #3607 fixed Snapcraft's Docker Python setup by correcting PATH and symlinks and adding a site-packages .pth file; landed as 6f2dc4445.
74%
#5079 Cannot run snapcraft in docker anymore snapcraft open Snapcraft extracted into Docker fails with a snapctl/snapd-socket internal error; a custom Python-module launcher workaround succeeds, while a maintainer keeps the triaged issue open to improve errors.
74%
#5420 Snapcraft 7 fails to launch a LXD container based on host apt sources entries snapcraft closed Closed as a duplicate of canonical/snapcraft#4408; no separate fix was made for this report.
70%