Skip to content

[BUG] Invoking the version subcommand in the container image ghcr.io/k3d-io/k3d:5.8.1 and later does not print out the correct version of k3d #1564

Open
@hrivera-ntap

Description

@hrivera-ntap

What did you do

$> nerdctl run -it --rm ghcr.io/k3d-io/k3d:5.8.3 version
ghcr.io/k3d-io/k3d:5.8.3:                                                         resolved       |++++++++++++++++++++++++++++++++++++++| 
index-sha256:0a9d521e3d14b740e2f407ef549db6a252ac37ac0f331e3dc39657859424d969:    done           |++++++++++++++++++++++++++++++++++++++| 
manifest-sha256:8e248040708a556a65f05cea51b7217455de52f2d9e29fc9cec97a5610a22968: done           |++++++++++++++++++++++++++++++++++++++| 
config-sha256:4f8c094ba1296cf53ba73193745df43d8b496c360a09fb87a945a71eddabcd48:   done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:6687191d15ae99c2e198e43c53d7e263959d41f2968f4b8fb805dfe59a9dc976:    done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:789b86ae5a5a9bef7636d8f5c83cc844a1052598a2984eb16d71c837ab6b01dd:    done           |++++++++++++++++++++++++++++++++++++++| 
elapsed: 11.1s                                                                    total:  7.9 Mi (732.2 KiB/s)                                     
k3d version v5-dev
k3s version v1.31.5-k3s1 (default)

What did you expect to happen

Expected k3d version v5.8.3 to be printed out instead of k3d version v5-dev.

See below how v5.7.5 is the last version that was printing out the correct version.

$> nerdctl run -it --rm ghcr.io/k3d-io/k3d:5.7.5 version
ghcr.io/k3d-io/k3d:5.7.5:                                                         resolved       |++++++++++++++++++++++++++++++++++++++| 
index-sha256:c458586d927f2e9f3b2c396ba76c34cead32b4c0e2d9b9f8c76ebd8332624b76:    done           |++++++++++++++++++++++++++++++++++++++| 
manifest-sha256:142a10188390d62c8d73f07924a6df1be238495bd34a2a0a7879b72b233c9e60: done           |++++++++++++++++++++++++++++++++++++++| 
config-sha256:72dadcd1394166a6d53848d3e1a3e275c8c91a4c791907e1b4af0101086a0733:   done           |++++++++++++++++++++++++++++++++++++++| 
elapsed: 2.7 s                                                                    total:   0.0 B (0.0 B/s)                                         
k3d version v5.7.5
k3s version v1.30.6-k3s1 (default)

It seems to have started happening in v5.8.1, but I could not find anything terribly obvious from the changes between v5.7.5 and v5.8.1 (v5.7.5...v5.8.1), maybe someone with better insight could shed some light on what is going on.

My best guess is there is something missing with the build process where it is no longer compiling the git tag into the Version string when it builds the k3d binary that gets packaged into the image (https://github.com/k3d-io/k3d/blob/main/version/version.go#L34-L54)

Screenshots or terminal output

I captured some details of the container image ghcr.io/k3d-io/k3d:5.8.3

$> nerdctl image ls ghcr.io/k3d-io/k3d:5.8.3            
REPOSITORY            TAG      IMAGE ID        CREATED          PLATFORM       SIZE       BLOB SIZE
ghcr.io/k3d-io/k3d    5.8.3    0a9d521e3d14    5 seconds ago    linux/arm64    23.29MB    8.321MB
$> nerdctl image inspect 0a9d521e3d14                   
[
    {
        "Id": "sha256:4f8c094ba1296cf53ba73193745df43d8b496c360a09fb87a945a71eddabcd48",
        "RepoTags": [
            "ghcr.io/k3d-io/k3d:5.8.3"
        ],
        "RepoDigests": [
            "ghcr.io/k3d-io/k3d@sha256:0a9d521e3d14b740e2f407ef549db6a252ac37ac0f331e3dc39657859424d969"
        ],
        "Parent": "",
        "Comment": "buildkit.dockerfile.v0",
        "Created": "2025-02-15T19:29:38.97778005Z",
        "DockerVersion": "",
        "Author": "",
        "Config": {
            "AttachStdin": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "WorkingDir": "/",
            "Entrypoint": [
                "/bin/k3d"
            ],
            "Labels": {
                "org.opencontainers.image.created": "2025-02-15T19:07:38.854Z",
                "org.opencontainers.image.description": "Little helper to run CNCF's k3s in Docker",
                "org.opencontainers.image.licenses": "MIT",
                "org.opencontainers.image.revision": "201b614ea6798f0ee9e75c63360eef891b36bb19",
                "org.opencontainers.image.source": "https://github.com/k3d-io/k3d",
                "org.opencontainers.image.title": "k3d",
                "org.opencontainers.image.url": "https://github.com/k3d-io/k3d",
                "org.opencontainers.image.version": "5"
            }
        },
        "Architecture": "arm64",
        "Os": "linux",
        "Size": 23285760,
        "VirtualSize": 23285760,
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:8dc18037e0e0573f3803e39a21ef735370d62ed8f88eac181752ea552617177d",
                "sha256:cf4d59eecbad8b3b4d7a7bb0eebba43c4f9cb15000ac419e66d54651b3f94503"
            ]
        },
        "Metadata": {
            "LastTagTime": "0001-01-01T00:00:00Z"
        }
    }
]
nerdctl run -it --rm ghcr.io/k3d-io/k3d:5.8.1 --version
ghcr.io/k3d-io/k3d:5.8.1:                                                         resolved       |++++++++++++++++++++++++++++++++++++++| 
index-sha256:193f51b014a13666a48782dc869a0bb7218673c8034c5dc2c010db34bd2b4d2f:    done           |++++++++++++++++++++++++++++++++++++++| 
manifest-sha256:6481063896c9d27827ac0eec540330ef44e5f4acf7214a6b9532224c837c693e: done           |++++++++++++++++++++++++++++++++++++++| 
config-sha256:2d3d56400da463154c2123442a1579285a4f48db619b76e8c931882bdb7b56b0:   done           |++++++++++++++++++++++++++++++++++++++| 
elapsed: 2.8 s                                                                    total:   0.0 B (0.0 B/s)                                         
k3d version v5-dev
k3s version v1.31.4-k3s1 (default)

Which OS & Architecture

N/A

Which version of k3d

nerdctl run -it --rm ghcr.io/k3d-io/k3d:5.8.3 --version
k3d version v5-dev
k3s version v1.31.5-k3s1 (default)

Which version of docker

$> nerdctl version
Client:
 Version:	v2.0.2
 OS/Arch:	linux/arm64
 Git commit:	1220ce7ec2701d485a9b1beeea63dae3da134fb5
 buildctl:
  Version:	v0.18.1
  GitCommit:	eb68885955169461d72dc2b7e6d084100fcaba86

Server:
 containerd:
  Version:	v1.7.17
  GitCommit:	3a4de459a68952ffb703bbe7f2290861a75b6b67
 runc:
  Version:	1.1.14
  GitCommit:	2c9f5602f0ba3d9da1c2596322dfc4e156844890

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions