Skip to content

[enhancement]: Enable the use of Podman image ID's in the Docker@2 task without errors #19432

Closed
@nwallace83

Description

Task name

Docker@2

Describe your feature request here

When using podman as an alternative for docker (alias docker=podman) the Docker@2 task is able to build and push images successfully, but non-breaking errors are printed to the console because podman doesn't use the same format for the image ID.

error:

/app/azure/pipeline_tools/docker inspect -f {{.RootFS.Layers}}
Error: no names or ids specified
##[error]Error: no names or ids specified

This happens because podman and docker don't follow the same format for image ID's. Podman does not include sha256: in the image ID like docker....

$ docker history --format "layerId:{{.ID}}" --no-trunc 511ee6833cb8
...
layerId:sha256:511ee6833cb859d887bb090fe8c948bb268abc10c42f8c5830e25de78a72c9e8
...
$ podman history --format "layerId:{{.ID}}" --no-trunc 511ee6833cb8
...
layerId:511ee6833cb859d887bb090fe8c948bb268abc10c42f8c5830e25de78a72c9e8
...

Below is the code snippet from the Docker@v2 task that requires the image ID to contain the sha256: string. If this was expanded to include the podman image ID format it would allow the task to run without error.

/azure-pipelines-tasks-docker-common-v2/dockercommandutils.js

function parseHistoryForV1Name(topHistoryLayer) {
    let v1Name = "";
    const layerIdString = "layerId:sha256:";
    const indexOfLayerId = topHistoryLayer.indexOf(layerIdString);
    if (indexOfLayerId >= 0) {
        v1Name = topHistoryLayer.substring(indexOfLayerId + layerIdString.length);
    }
    return v1Name;
}

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions