containerd / containerd/nerdctl

compose images returns wrong image ID

Open
#2,198 0 comments 0 reactions 0 assignees View on GitHub
kind/unconfirmed-bug-claim
Dominant language
Go
Stars
10.4k
Forks
826
Avg merge
1d 23h
Merged PRs (30d)
44

Description

### Description

It seems like `nerdctl` outputs wrong image IDs with `nerdctl compose images`.

It always shows the latest ID of an image, but not that ID of the image that was used when the container started.

### Steps to reproduce the issue

1. Launch a container: `nerdctl compose up -d`
1. Print the image ID: `nerdctl compose images`
2. Pull a newer image: `nerdctl compose pull`
3. Show the image ID again: `nerdctl compose images`

You can reproduce this with a small compose file and Dockerfile build.

```
services:
issue:
build:
dockerfile: Containerfile
image: issue:latest
container_name: issue
restart: always
```

```
FROM debian:latest

RUN echo "XYZ" >> /var/container.txt

ENTRYPOINT ["tail", "-f", "/dev/null"]
```

Create the image `nerdctl compose build --no-cache` and start the container `nerdctl compose up -d`.

```
nerdctl compose images
Container Repository Tag Image Id Size
issue issue latest 42d69432d2e9 135.1 MiB
```

Now change the value in the Dockerfile from XYZ to something different and build again `nerdctl compose build --no-cache`.

```
nerdctl compose images
Container Repository Tag Image Id Size
issue issue latest 1ec2af01ced1 135.1 MiB
```

I get now a value of 1ec2af01ced1 which is wrong. The container was started with image ID 42d69432d2e9.

### Describe the results you received and expected

I got the latest image ID but not that one that is running.

### What version of nerdctl are you using?

Client:
Version: 1.3.1
OS/Arch: linux/amd64
Git commit: b224b280ff3086516763c7335fc0e0997aca617a
buildctl:
Version: 0.11.5
GitCommit: 252ae63bcf2a9b62777add4838df5a257b86e991

Server:
containerd:
Version: v1.7.0
GitCommit: 1fbd70374134b891f97ce19c70b6e50c7b9f4e0d.m
runc:
Version: 1.1.6

### Are you using a variant of nerdctl? (e.g., Rancher Desktop)

None

### Host information

Client:
Namespace: default
Debug Mode: false

Server:
Server Version: v1.7.0
Storage Driver: overlayfs
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Log: fluentd journald json-file syslog
Storage: btrfs native overlayfs
Security Options:
seccomp
Profile: default
cgroupns
Kernel Version: 6.2.11-arch1-1
Operating System: Arch Linux
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.37GiB
Name: w00t
ID: 58123ea9-3151-4d24-7935-8abec672bcaf

WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.