4

I was using this for docker:

- name: Build container image
  uses: actions/docker/cli@master
  with:
    ///// removed

- name: Docker Login
  uses: actions/docker/login@master
  env:
    ///// removed

However github.com/actions/docker do not seem to exist anymore.

My builds are giving 404:

Failed to download action 'https://api.github.com/repos/actions/docker/tarball/master'. Error Response status code does not indicate success: 404 (Not Found).

Does anyone know the new location?

Noitidart
  • 35,443
  • 37
  • 154
  • 323
  • 1
    They must have deleted the `actions/docker` repository completely just recently. It was archived for a while with the message I posted in my answer. – peterevans Oct 12 '19 at 03:44

1 Answers1

10

The actions/docker action has now been deprecated. The repository was archived with the following message before being deleted entirely.

This action is deprecated in favor of using the run script step in the new YAML language to run the docker cli.

So the recommended way to use Docker is to use the run script command. The official starter workflow shows a simple example to build an image. https://github.com/actions/starter-workflows/blob/master/ci/docker-image.yml

For more complete examples of Docker image publishing see the following workflows.

For the public DockerHub registry:

name: my workflow
on:
  push:
    branches:
      - master
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Login to DockerHub Registry
        run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
      - name: Build the Docker image
        run: docker build -t myimage:latest .
      - name: Tag the Docker image
        run: docker tag myimage:latest myimage:1.0
      - name: Push the Docker image to the registry
        run: docker push myimage:1.0

For a private registry, such as the new GitHub Package Registry, you also need to specify the hostname when logging in and tag the image appropriately:

name: my workflow
on:
  push:
    branches:
      - master
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Login to GitHub Package Registry
        run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{ github.repository }} --password-stdin
      - name: Build the Docker image
        run: docker build -t myimage:latest .
      - name: Tag the Docker image
        run: docker tag myimage:latest docker.pkg.github.com/username/repository/myimage:1.0
      - name: Push the Docker image to the registry
        run: docker push docker.pkg.github.com/username/repository/myimage:1.0
peterevans
  • 34,297
  • 7
  • 84
  • 83
  • 1
    It's a mixture of following developments over the beta period, reading the documentation, and my own experiments. – peterevans Oct 12 '19 at 09:58
  • 1
    Oh wow thanks for that extra gold nugget of github container registry! I had no idea! Going to go learn about that now because I really didn't want to pay for docker hub private registries. – Noitidart Oct 12 '19 at 10:06
  • May you please explain the `echo "${{ secrets.DOCKER_PASSWORD }}" | docker login docker.pkg.github.com -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin`. I was always just doing `docker login -u "foo_user" -p "foo_pw"`. What is the difference? – Noitidart Oct 12 '19 at 10:14
  • Also unrelated question, but if my repo is private, will docker images I publish to its package registry be private? – Noitidart Oct 12 '19 at 10:16
  • 1
    See this answer about docker login: https://stackoverflow.com/questions/51489359/docker-using-password-via-the-cli-is-insecure-use-password-stdin About the package registry. Yes, I believe that is how it works. If the repo is private the packages are too. – peterevans Oct 12 '19 at 10:20
  • Wow thanks again Peter, I learned 3 things from one solution (pckage registry, fixing that docker password getting saved to logs issue) – Noitidart Oct 12 '19 at 10:25
  • 2
    Login to GitHub Package Registry: `echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{ github.repository }} --password-stdin` – Joe Bowbeer Mar 19 '20 at 06:36