I'm running a CI pipeline (ubuntu-latest) and I'm trying to save a docker image as an artifact for later usage on a release pipeline, however I keep getting the same error:
This is my complete pipeline setup:
pool:
name: Azure Pipelines
variables:
ImageName: 'thecreatorshare'
steps:
- task: CopyFiles@2
displayName: 'Copy Files to Staging Directory'
inputs:
SourceFolder: core
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: DockerInstaller@0
displayName: 'Install Docker'
- task: Docker@2
displayName: 'Build Image'
inputs:
containerRegistry: 'azure-registry-conn'
repository: '$(ImageName)'
command: build
Dockerfile: core/Dockerfile
- task: Docker@2
displayName: 'Save Image'
inputs:
containerRegistry: 'azure-registry-conn'
repository: '$(ImageName)'
command: save
arguments: '$(ImageName):$(Build.BuildId) > $(Build.ArtifactStagingDirectory)/$(ImageName).tar'
- task: PublishBuildArtifacts@1
displayName: 'Publish Image as Artifact'
And finally, this is my Dockerfile:
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /web
COPY . .
RUN dotnet restore "Presentation.Web/Presentation.Web.csproj" -s https://api.nuget.org/v3/index.json
WORKDIR "/web/Presentation.Web"
RUN dotnet build "Presentation.Web.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Presentation.Web.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Presentation.Web.dll"]
After a whole day of failed attempts, I am clueless as what to do, any help is much appreciated!