Azure / Azure/docker-login

Login to ACR apparently successful but subsequent dotnet publish fails

Open
#52 2 comments 0 reactions 0 assignees View on GitHub
need-to-triage
Dominant language
TypeScript
Stars
117
Forks
58
PR merge metrics
No merged PRs in 30d

Description

I am trying to use this code to push a .NET 7 container image to my ACR:

```
- name: Azure Container Registry Login
uses: Azure/docker-login@v1
with:
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
login-server: ${{ secrets.ACR_REGISTRY_URL }}
- name: Publish
run: dotnet publish --os linux --arch x64 --configuration Release -p:PublishProfile=DefaultContainer
```

The login to the CR apparently succeeds (completes without error):

```
Run Azure/docker-login@v1
with:
username: ***
password: ***
login-server: ***
env:
BUILD_VERSION: [2](https://github.com/Monte-Christo/dotnet7-docker/actions/runs/3563058595/jobs/5985420750#step:6:2)022.11.2[8](https://github.com/Monte-Christo/dotnet7-docker/actions/runs/3563058595/jobs/5985420750#step:6:8)-11
DOTNET_ROOT: C:\Program Files\dotnet
DOCKER_CONFIG environment variable is set
```

but the subsequent publish fails (contents of config.json added to aid debugging):
```
Run cat $HOME/.docker/config.json
cat $HOME/.docker/config.json
dotnet publish --os linux --arch x64 --configuration Release -p:PublishProfile=DefaultContainer
shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
env:
BUILD_VERSION: 2022.11.28-11
DOTNET_ROOT: C:\Program Files\dotnet
DOCKER_CONFIG: D:\a\_temp\docker_login_1669624656512
{
"auths": {
"https://index.docker.io/v1/": {
"auth": "redacted"
}
}
}
MSBuild version 17.4.0+18d5aef85 for .NET
Determining projects to restore...
Restored D:\a\dotnet7-docker\dotnet7-docker\dotnet7-docker.csproj (in 2.67 sec).
dotnet7-docker -> D:\a\dotnet7-docker\dotnet7-docker\bin\Release\net7.0\linux-x64\dotnet7-docker.dll
dotnet7-docker -> D:\a\dotnet7-docker\dotnet7-docker\bin\Release\net7.0\linux-x64\publish\
Building image 'weatherforecast-api' with tags 2022.11.28-11 on top of base image mcr.microsoft.com/dotnet/aspnet:7.0
Uploading layer sha256:a60[3](https://github.com/Monte-Christo/dotnet7-docker/actions/runs/3563058595/jobs/5985420750#step:7:3)fa5e3b[4](https://github.com/Monte-Christo/dotnet7-docker/actions/runs/3563058595/jobs/5985420750#step:7:4)127f210[5](https://github.com/Monte-Christo/dotnet7-docker/actions/runs/3563058595/jobs/5985420750#step:7:5)03aaa[6](https://github.com/Monte-Christo/dotnet7-docker/actions/runs/3563058595/jobs/5985420750#step:7:6)189abf6286ee5a[7](https://github.com/Monte-Christo/dotnet7-docker/actions/runs/3563058595/jobs/5985420750#step:7:7)3deeaab460f[8](https://github.com/Monte-Christo/dotnet7-docker/actions/runs/3563058595/jobs/5985420750#step:7:8)f33ebc6b64e2 to registry
Uploading layer sha256:478[9](https://github.com/Monte-Christo/dotnet7-docker/actions/runs/3563058595/jobs/5985420750#step:7:10)09de3dddf82d41bf49336ca75e99dda4b994ff95f8b3c7f9929eccf5bd9c to registry
Uploading layer sha256:42b07697[10](https://github.com/Monte-Christo/dotnet7-docker/actions/runs/3563058595/jobs/5985420750#step:7:11)d8d902794c709bb43daa609dbfbcabec0035151652de886592e7f5 to registry
Uploading layer sha256:165f2f6a3267d0655553c5e46e5da98fee9656d18a69d6658864a9ddbfceb716 to registry
Uploading layer sha256:e573684406723b55606ecce5f188244d5ca85ba1fcd17f4394580cb4b4d3bce6 to registry
Uploading layer sha256:af9f2d1c1d74aee03ce2cc5565b97ec022298413400cf8bd2781e85e6251fcac to registry
C:\Users\runneradmin\.nuget\packages\microsoft.net.build.containers\0.2.7\build\Microsoft.NET.Build.Containers.targets([12](https://github.com/Monte-Christo/dotnet7-docker/actions/runs/3563058595/jobs/5985420750#step:7:13)4,9): error : Failed to push to the output registry: System.AggregateException: One or more errors occurred. (Failed retrieving credentials for "seeman.***": No matching auth specified for registry 'seeman.***' in Docker config 'D:\a\_temp\docker_login_[16](https://github.com/Monte-Christo/dotnet7-docker/actions/runs/3563058595/jobs/5985420750#step:7:17)696[24](https://github.com/Monte-Christo/dotnet7-docker/actions/runs/3563058595/jobs/5985420750#step:7:25)656512\config.json'.) [D:\a\dotnet7-docker\dotnet7-docker\dotnet7-docker.csproj]
```
Apparently, the auth for the ACR is not added to config.json.

If i use
```
- name: Login to ACR
run: |
az acr login -n seeman -u ${{ secrets.ACR_USERNAME }} -p ${{ secrets.ACR_PASSWORD }}
```
instead of the Azure/docker-login@v1 task, everything works as expected.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.