Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compose images command #1555

Merged
merged 1 commit into from
Nov 28, 2022
Merged

Conversation

djdongjin
Copy link
Member

@djdongjin djdongjin commented Nov 26, 2022

The command prints images used by created containers in services (docker doc)

It supports --quiet and always truncates image ids (same as docker command).

I only prints size column and not blob size (or both) to be consistent with docker output. Please let me know if we want more columns.

A running example:

docker-compose.yaml

$ cat docker-compose.yml
version: '3.1'
services:
  svc0:
    image: alpine
    # restart: always
  svc1:
    image: alpine
    # restart: always
  svc2:
    image: nginx
# up one svc
$ sudo nerdctl compose up svc2 -d
...
$ sudo nerdctl compose images
Container                Repository    Tag       Image Id        Size
compose-images_svc2_1    nginx         latest    e209ac2f37c7    146.5 MiB

# up all svcs
$ sudo nerdctl compose up -d
...
# shows 3 images from 3 svc containers
$ sudo nerdctl compose images
Container                Repository    Tag       Image Id        Size
compose-images_svc0_1    alpine        latest    8914eb54f968    7.0 MiB
compose-images_svc1_1    alpine        latest    8914eb54f968    7.0 MiB
compose-images_svc2_1    nginx         latest    e209ac2f37c7    146.5 MiB
# shows 2 images ids because of dedup
$ sudo nerdctl compose images -q
8914eb54f968
e209ac2f37c7

# same output in docker compose
$ docker compose images
Container               Repository          Tag                 Image Id            Size
compose-images-svc0-1   alpine              latest              d3156fec8bcb        7.46MB
compose-images-svc1-1   alpine              latest              d3156fec8bcb        7.46MB
compose-images-svc2-1   nginx               latest              88736fe82739        142MB

Signed-off-by: Jin Dong jindon@amazon.com

Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Thanks

@AkihiroSuda
Copy link
Member

Needs rebase

The command prints images used by created containers in services.

Signed-off-by: Jin Dong <jindon@amazon.com>
@AkihiroSuda AkihiroSuda added this to the v1.1.0 milestone Nov 28, 2022
@AkihiroSuda AkihiroSuda merged commit 272dc9c into containerd:main Nov 28, 2022
@djdongjin djdongjin deleted the compose-images branch November 28, 2022 03:47
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