runner icon indicating copy to clipboard operation
runner copied to clipboard

Option to not do docker pull?

Open rowleya opened this issue 5 years ago • 17 comments

Thank you 🙇‍♀ for wanting to create a feature in this repository. Before you do, please ensure you are filing the issue in the right place. Issues should only be opened on if the issue relates to code in this repository.

If you have a feature request that is relevant to this repository, the runner, then please include the information below:

Describe the enhancement If I have a local runner and a locally maintained docker image i.e. not stored on a repository, I would like to avoid the "docker pull" step, which then fails.

Code Snippet

name: Self Hosted Tests

on: [push]

jobs:
  integration_tests:
      runs-on: self-hosted
      container:
          image: python3.6:latest
      steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: What java version do we have
        run: java -version

Additional information The image python3.6:latest is in my self-hosted runner's docker images. It doesn't exist in DockerHub or any other repository, and I don't want it to, because it should only ever be run on my self-hosted runner.

NOTE: if the feature request has been agreed upon then the assignee will create an ADR. See docs/adrs/README.md

rowleya avatar Nov 05 '20 11:11 rowleya

Perhaps the design discussions belong here instead. I just commented over on the PR with a question about whether it would work to instead support specifying a pull: true/false option to the jobs.<job-id>.container syntax.

https://github.com/actions/runner/pull/800#issuecomment-838111961

baparham avatar May 11 '21 09:05 baparham

Yes, I agree that this would also work

rowleya avatar May 11 '21 09:05 rowleya

without doing any of the coding, my hunch tells me that doing it that way would bypass the "which exceptions to handle" issue entirely.

baparham avatar May 11 '21 09:05 baparham

I think I was just avoiding the "how do you add a new config option" at this point; I agree that this should skip this part, since it will just do the pull if asked and if that fails, it would fail in the same way as previously.

rowleya avatar May 11 '21 09:05 rowleya

Yeah, that sounds a bit more complicated now that you mention it. Perhaps https://github.com/actions/runner/pull/694/ can provide some insight on adding the new option though?

baparham avatar May 11 '21 09:05 baparham

Thanks for the pointer - I will have a look and see.

rowleya avatar May 11 '21 09:05 rowleya

I think I have done the right things in #1086 but happy for someone to review this to tell me otherwise!

rowleya avatar May 11 '21 09:05 rowleya

Up

AllanOricil avatar Apr 19 '23 11:04 AllanOricil

docker does not pull the image again if it exists already: image

But you have to publish the image to a registry so that the pull ackowledges that the image has not changed. To avoid using a remote registry, you can start a local registry in the runner docker run registry, and publish the image to this registry. Then, in the workflow job, write this:

container:
    image: <IP_ADDRESS>:<PORT>/<IMAGE_NAME>:<IMAGE_TAG>

AllanOricil avatar Apr 19 '23 11:04 AllanOricil

docker does not pull the image again if it exists already:

I'm not experiencing this when using ecr. It pulls the same image even if sha digest match and it was used in a different job in the same workflow. Is this a feature of ghcr.io that it'll recognize that it already downloaded the latest?

ddresslerlegalplans avatar May 04 '23 22:05 ddresslerlegalplans

No, it is a docker pull feature. It worked for me. Are you sure you are running on the same host?

AllanOricil avatar May 04 '23 23:05 AllanOricil

This occurs when running on the same worflow file but different jobs. I guess it doesn't share the previous pull from a previous job in the workflow.

ddresslerlegalplans avatar May 05 '23 19:05 ddresslerlegalplans

No, they do not. Unless you run the job in the same runner.

AllanOricil avatar May 05 '23 20:05 AllanOricil

It would be really helpful if these options were supported:

pull: if-not-exists # only pull the image if not found in the local cache
pull: always # always pull the newest version of the image
pull: never # never pull the image and always use the image in the local cache

This allows baking docker images into AMIs, and use if-not-exists so it only downloads when necessary.

sdarwin avatar Jun 01 '23 15:06 sdarwin

It would be really helpful if these options were supported:

pull: if-not-exists # only pull the image if not found in the local cache
pull: always # always pull the newest version of the image
pull: never # never pull the image and always use the image in the local cache

This allows baking docker images into AMIs, and use if-not-exists so it only downloads when necessary.

Realy helpful with these options.

QuarkLarry avatar Jul 11 '23 01:07 QuarkLarry

I have a job where I pull the images I need and then another that uses the images to run a container. they are running on the same runner and it is still trying to pull from the ECR

ricardo-noyolalozano avatar Nov 15 '23 00:11 ricardo-noyolalozano

+1

xihajun avatar Aug 05 '24 14:08 xihajun

+1

jalperfm avatar Jun 04 '25 22:06 jalperfm

+1

dmitry-rozhd avatar Jun 24 '25 13:06 dmitry-rozhd