Docker can't find my image to save it

Expected behavior

I have an azure devops pipeline. Basically, what I am trying to do is build a docker image and then push it to our azure container registry. I can build the image but when I try to save it as a .tar file no matter what I do it can’t find the image. I have listed the pipeline below. Expected behavior should be that it saves the image as a .tar file. Any help on commands that could save the image would be appreciated or let me know if I am trying to tackle this whole thing the wrong way.

Actual behavior

If I run the below pipeline it can’t grep and get the image id so it returns the error ““docker save” requires at least 1 argument.”

If I run any of the below docker saves I get “Error response from daemon: reference does not exist”

If I try any other versions of the docker save command I get the error “invalid reference format”

docker save -o D:\a\1\dsscLatest.tar "***/dssc-solution:latest"
docker save dssc-solution:latest -o D:\a\1\MY_IMAGE_FILE.tar
docker save dssc-solution:latest -o D:\a\_temp\MY_IMAGE_FILE.tar
docker save -o D:\a\1\dsscLatest.tar "***/dssc-solution:latest"
docker save -o test-latest.tar dssc-solution:latest
docker save dssc-solution:latest -o MY_IMAGE_FILE.tar

Additional Information

I am running this pipeline on a windows agent.

stages:
  - stage: buildImage
    dependsOn: []
    jobs:
    - job: Build
      displayName: ☁ Azure & K8s artifacts
      pool: 
        vmImage: windows-latest
      steps:
      - checkout: CodeBaseRepo
      - task: DockerCompose@0
        inputs:
          containerregistrytype: 'Container Registry'
          dockerRegistryEndpoint: 'blah'
          dockerComposeFile: 'docker-compose.yml'
          additionalDockerComposeFiles: 'docker-compose.override.yml'
          action: 'Run a Docker Compose command'
          dockerComposeCommand: 'build --no-cache solution'
      - task: Bash@3
        displayName: Save Docker Image
        inputs:
          targetType: 'inline'
          script: |
            docker images
            image_id=$(docker images | grep "***/dssc-solution latest" | awk '{print $3}')
            echo $image_id
            docker save $image_id -o D:\a\_temp\MY_IMAGE_FILE.tar

Steps to reproduce the behavior

You need to reference the image by repo:tag and not by id.
Try: docker save -o D:\a\_temp\MY_IMAGE_FILE.tar ***/dssc-solution:latest

Update: I see that you actually tried that already. You must use the exact same repo:tag, as declared as image: within your compose file.

In our compose file we specify the image like so ${COMPOSE_PROJECT_NAME}-solution:${VERSION:-latest} where the COMPOSE_PROJECT_NAME is “dssc”. I don’t get where it is getting the “***/” to start the repo though.

… and thought you used *** as a placeholder to anonymize the group of the repo ^^
I have no idea why your image is prefixed with ***/. The only thing I can say is that the repo:tag used to build and save the image must be identical.

You might want to get in touch with the maintainer of the DockerCompose@0 task and ask him about it.