Skip to content

Add content interface to write configurations from another snap#328

Open
farshidtz wants to merge 1 commit into
mainfrom
config-slot
Open

Add content interface to write configurations from another snap#328
farshidtz wants to merge 1 commit into
mainfrom
config-slot

Conversation

@farshidtz

@farshidtz farshidtz commented Nov 11, 2025

Copy link
Copy Markdown
Member

Adding the write-slot that was excluded from #158

Closes #299

The snap that writes the config needs to have a corresponding plug, e.g.:

plugs:
  docker:
    interface: content
    content: docker-config
    target: $SNAP_DATA/docker-config

And a logic that modifies the config, e.g. snap/hooks/connect-plug-docker:

# Set log-level to debug
CONFIG_FILE="$SNAP_DATA/docker-config/daemon.json"  
jq '.["log-level"] = "debug"' "$CONFIG_FILE" \
    > "$CONFIG_FILE.tmp" && \
    mv "$CONFIG_FILE.tmp" "$CONFIG_FILE"

Full example: https://github.com/farshidtz/docker-config-provider-snap

Caution

Changes made to daemon.json may be overwritten. The Docker snap with nvidia support writes to the config directory and modifies the daemon.json file during the setup.

@GairePravesh

Copy link
Copy Markdown

Tested, works for me, waiting for customer approval.

@farshidtz

Copy link
Copy Markdown
Member Author

Thanks @GairePravesh for testing. I'll close this for now because of the configuration conflict with the NVIDIA container runtime setup.

Let's revisit this once there is a demand for it.

@0mniteck

Copy link
Copy Markdown

I will test this soon as well as I have a need for this content slot.
Related issues: #132, #10, #299, #158, #328
Considering trying to build a new generally available docker-credential-helper thats is up to date and multi-arch.
And with a rootless docker daemon (using the config-slot rw)
On the snapstore it will be called simply docker-helper

@farshidtz farshidtz reopened this Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

content slot for rw access to docker daemon config

3 participants