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