Solvedstarter workflows Use GITHUB_TOKEN to auth in

Try to publish docker container to

I got error: Error response from daemon: login attempt to failed with status: 401 Unauthorized

name: Deploy

on: [push]

    runs-on: ubuntu-latest
    - uses: actions/checkout@master
    - name: login
      run: echo ${GITHUB_TOKEN} | docker login -u ${GITHUB_ACTOR} --password-stdin
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 Answers

✔️Accepted Answer

I can confirm that this works for me:

    - name: Docker Login
      uses: azure/docker-login@v1
        username: $GITHUB_ACTOR
        password: ${{ secrets.GITHUB_TOKEN }}

Other Answers:

@landsman A personal access token - for now, you can create one with the write:packages permission, and store it in the secrets store to push to docker at this time.

Based on the reply saying "Docker isn't supported at the moment", and that this blog post added support for GITHUB_TOKEN usage to Nuget, I suspect the built-in GITHUB_TOKEN is planned to work for Docker in the future.

Good. Now we can do

    - name: Checkout
      uses: actions/checkout@v2
    - run: |
        echo "${{ github.token }}" | docker login -u ${GITHUB_ACTOR} --password-stdin
        docker build -t $IMAGE_NAME .
        docker push $IMAGE_NAME

@eine It's same. Just shorter, lol.

For me, the main value proposition of GitHub Actions is that everything is integrated under one umbrella. Until that's not true, it's not better than the competition who has their services up and running probably for years now. I understand that this is a beta program, but still, GitHub needs to "kick ass" if they want to enter this market. Otherwise it's just another service and there won't be any incentive in it for users to migrate their projects to GitHub Actions.