addnab / docker-run-action

MIT License
209 stars 93 forks source link

Running an image built in previous step doesn't work anymore #13

Closed shakib609 closed 3 years ago

shakib609 commented 3 years ago

This part of the documentation does not work as expected anymore.

- uses: docker/build-push-action@v1
  with:
    repository: test-image
    push: false
- uses: addnab/docker-run-action@v3
  with:
    image: test-image:latest
    run: echo "hello world"

docker/build-push-action gives the below warning while running action.

Warning: Input 'repository' has been deprecated with message: v2 is now available through docker/build-push-action@v2
addnab commented 3 years ago

Thanks. I've updated the README.

pmoosh commented 2 years ago

Question I am using the example and it fails with: docker: Error response from daemon: pull access denied for test-image, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.

Am I missing something?

winghouchan commented 2 years ago

@pmoosh: you likely need to specify load: true for build-push-action. For example:

      - name: Build Docker image
        uses: docker/build-push-action@v2
        with:
          tags: <your-tag>
          load: true
          push: false

I discovered this when I was trying to debug the same issue you were having. Running docker images didn't list the tagged image. I happened to decide to read the documentation for docker buildx build and found the following:

Load the single-platform build result to docker images (--load)

Shorthand for --output=type=docker. Will automatically load the single-platform build result to docker images.

In documentation for build-push-action, the default for load is false.

@addnab: maybe the example in the README could be updated?

#### run an image built by a previous step
```yaml
– uses: docker/build-push-action@v2
  with:
    tags: test-image:latest
    push: false
+   load: true
– uses: addnab/docker-run-action@v3
  with:
    image: test-image:latest
    run: echo "hello world"