Skip to content

feat: support compose image volumes - #5161

Open
papidb wants to merge 1 commit into
containerd:mainfrom
papidb:feat/support-image-volumes
Open

feat: support compose image volumes#5161
papidb wants to merge 1 commit into
containerd:mainfrom
papidb:feat/support-image-volumes

Conversation

@papidb

@papidb papidb commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Support Compose long-syntax image volumes by translating them to the existing --mount=type=image implementation.

The Compose path now resolves image sources that reference active or disabled services, ensures missing mount-source images before the child command runs with --pull=never, and validates image-specific options before project resources are created. Image mounts remain read-only.

image.subpath was intentionally left alone until the lower-level support in #4993 is available.

Tests cover external and service-referenced sources, source pulling, read-only behavior, malformed definitions, mount-field injection, unchanged legacy volume arguments, and cleanup.

Related to #4767.

Signed-off-by: Daniel Benjamin <benjamindaniel706@gmail.com>
@AkihiroSuda AkihiroSuda added this to the v2.4.0 milestone Aug 25, 2026
testCase.Run(t)
}

func TestComposeImageVolumeServiceSource(t *testing.T) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI failing for Docker
https://github.com/containerd/nerdctl/actions/runs/32843708128/job/97846811402?pr=5161

  compose_up_linux_test.go:1339: 
        
        +------------------------------------------------------------------------------------------------------------+
        | ➡️      | ⚙️ /usr/bin/docker compose -p testcomposeimagevolumeservicesource-image-service-source-99d59bae  |
        |         | -f /tmp/TestComposeImageVolumeServiceSource3467620079/001/b9c9a923/compose.yaml up -d            |
        +------------------------------------------------------------------------------------------------------------+
        |         | 🚫 command returned a non-zero exit code                                                         |
        +------------------------------------------------------------------------------------------------------------+
        |         | ⚠️ 1                                                                                             |
        +------------------------------------------------------------------------------------------------------------+
        |         | 🟠  Image source Pulling                                                                         |
        |         |  Image source Error pull access denied for source, repository does not exist or may require 'doc |
        |         | ker login'                                                                                       |
        |         | Error response from daemon: pull access denied for source, repository does not exist or may requ |
        |         | ire 'docker login'                                                                               |
        +------------------------------------------------------------------------------------------------------------+
        | 🌱      | (hidden: set TIGRON_DEBUG_ENV=1 to display)                                                      |
        +------------------------------------------------------------------------------------------------------------+
        | ⏰      | <1s (limit: 3m0s)                                                                                |
        +------------------------------------------------------------------------------------------------------------+
        | 📁      | /tmp/TestComposeImageVolumeServiceSource3467620079/002                                           |
        +------------------------------------------------------------------------------------------------------------+
        

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm on it. Thanks.

@papidb

papidb commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Hi @AkihiroSuda quick question about Compose image volumes.

The Compose spec defines source as an image reference. Docker Compose follows this, except when source matches a service that builds an image using Compose’s default - name, I will match that behavior.

Docker does not resolve a service’s explicit image: or a service disabled by a profile. It treats source literally and tries to pull it as an image.

Should nerdctl match Docker and the spec for these two cases, or intentionally support them as a nerdctl extension by resolving the service’s image?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants