← Back to issue list

Cannot run snapcraft in docker anymore

View original Github issue

Metadata

Project
snapcraft
Number
#5079
Type
issue
State
open
Author
om26er
Labels
Status: Triaged Type: Enhancement
Created
Updated
Closed

Current evaluation

Snapcraft crashes with SnapCtlError when run in Docker without snapd; reporter found a working Dockerfile workaround, maintainer kept it open to improve error handling. Triaged as enhancement, last activity 493 days ago.

Suggested action: keep open

Reason: Maintainer mr-cal explicitly stated 'I'm going to leave this issue open because we can improve the error handling' after the reporter confirmed a workaround. The issue is triaged (Status: Triaged, Type: Enhancement) and the underlying crash path (snaphelpers SnapCtlError in craft_application config) is still present in the codebase, so the error-handling improvement remains valid.

Impact: 50 Quick Win: 30.0 Staleness: 65 Complexity: 40 Confidence: 75 Support Request: 40

Issue body

### Bug Description I cannot run snapcraft in docker container anymore. It requires snapd to be running. ### To Reproduce Build a docker container with snapcraft in it and then use that docker container to build a snap ### Environment Docker with noble based image ### snapcraft.yaml ```yaml no yaml config needed ``` ### Relevant log output ```shell root@d04e7a25f671:/datax# SNAP_INSTANCE_NAME=snapcraft snapcraft version snapcraft internal error: SnapCtlError('Call to snapctl failed with error 1: error: cannot communicate with server: Post "http://localhost/v2/snapctl": dial unix /run/snapd-snap.socket: connect: no such file or directory\n') Full execution log: '/root/.local/state/snapcraft/log/snapcraft-20240930-150845.117122.log' Traceback (most recent call last): File "/snap/snapcraft/current/lib/python3.10/site-packages/craft_application/application.py", line 568, in run return_code = self._run_inner() File "/snap/snapcraft/current/lib/python3.10/site-packages/snapcraft/application.py", line 215, in _run_inner return_code = super()._run_inner() File "/snap/snapcraft/current/lib/python3.10/site-packages/craft_application/application.py", line 521, in _run_inner platform = self.get_arg_or_config(parsed_args, "platform") File "/snap/snapcraft/current/lib/python3.10/site-packages/craft_application/application.py", line 511, in get_arg_or_config return self.services.config.get(item) File "/snap/snapcraft/current/lib/python3.10/site-packages/craft_application/services/config.py", line 175, in get value = handler.get_raw(item) File "/snap/snapcraft/current/lib/python3.10/site-packages/craft_application/services/config.py", line 103, in get_raw return self._snap.get(snap_item) File "/snap/snapcraft/current/lib/python3.10/site-packages/snaphelpers/_conf.py", line 125, in get options = self.get_options(top_key) File "/snap/snapcraft/current/lib/python3.10/site-packages/snaphelpers/_conf.py", line 114, in get_options options.fetch() File "/snap/snapcraft/current/lib/python3.10/site-packages/snaphelpers/_conf.py", line 86, in fetch self._config = self._snapctl.config_get(*self._keys) File "/snap/snapcraft/current/lib/python3.10/site-packages/snaphelpers/_ctl.py", line 147, in config_get conf = json.loads(self.run("get", "-d", *keys)) File "/snap/snapcraft/current/lib/python3.10/site-packages/snaphelpers/_ctl.py", line 271, in run raise SnapCtlError(process) snaphelpers._ctl.SnapCtlError: Call to snapctl failed with error 1: error: cannot communicate with server: Post "http://localhost/v2/snapctl": dial unix /run/snapd-snap.socket: connect: no such file or directory ``` ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 50
Quick Win: 30.0
Staleness: 65
Complexity: 40
Confidence: 75
Support Request: 40
keep open Snapcraft crashes with SnapCtlError when run in Docker without snapd; reporter found a working Dockerfile workaround, maintainer kept it open to improve error handling. Triaged as enhancement, last activity 493 days ago.
qwen/qwen3.6-35b-a3b
Staleness: 75
Complexity: 30
Confidence: 90
Support Request: 20
keep open Snapcraft fails in Docker due to missing snapd socket. User resolved via Dockerfile workaround. Maintainer acknowledged and requested keeping it open for error handling improvements.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 40
Confidence: 90
Support Request: 0
keep open Triaged enhancement to improve error handling when snapcraft runs in Docker without snapd. Maintainer explicitly requested it remain open for future implementation.
qwen3.6-35b-a3b-mtp-q6
Staleness: 80
Complexity: 40
Confidence: 75
Support Request: 10
keep open Snapcraft fails in Docker due to missing snapd socket and environment checks. Contributors shared workarounds using custom extraction and launcher scripts. The issue remains open to improve error handling and support containerized builds.

Update history

No update history recorded yet.

Related work

  • Related To: snapcore/snapcraft#3971 (confidence 70%)

    Commit 1aec6c84b 'snap config: do not crash when config cannot be retrieved (#3971)' addresses the same snapd-unavailable crash in snapcraft's own snap_config path, but the reported traceback goes through craft_application's config service instead.

  • Related To: snapcore/snapcraft#3974 (confidence 65%)

    Commit 3a1ed84d5 'snap config: catch more errors when config cannot be retrieved (#3974)' broadens the same error handling, relevant to the requested improvement.

  • Related To: snapcraft (launchpad)#1956216 (confidence 55%)

    Prior Launchpad bug about snapcraft not working in Docker, referenced in repo history (PR #3607) as an earlier instance of the same class of problem.

Related issues

Issue Project State Summary Similarity
#1956216 Snapcraft is no longer working within a Docker container snapcraft (launchpad) closed Closed without resolution. The report detailed a snapcraft ModuleNotFoundError in Docker containers, but received no comments or fixes. The issue remains abandoned.
77%
#1836355 Docker Container https://hub.docker.com/r/snapcore/snapcraft on edge doesnt contain snapd snapcraft (launchpad) closed Closed without resolution. The report regarding missing snapd in the snapcore/snapcraft:edge Docker image was abandoned due to prolonged inactivity. No fix or follow-up was provided.
72%
#1826611 Running snapcraft 3 w/ core18 base in docker incorrectly reports missing lib deps snapcraft (launchpad) closed Closed as stale. Snapcraft resolved the issue by updating its Dockerfiles and migrating to OCI rocks for builds, eliminating the incorrect core18 dependency warnings in Docker.
70%