Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to not do docker pull? #791

Open
rowleya opened this issue Nov 5, 2020 · 16 comments 路 May be fixed by #800 or #1086
Open

Option to not do docker pull? #791

rowleya opened this issue Nov 5, 2020 · 16 comments 路 May be fixed by #800 or #1086
Labels
enhancement New feature or request

Comments

@rowleya
Copy link

rowleya commented Nov 5, 2020

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 rowleya added the enhancement New feature or request label Nov 5, 2020
@rowleya rowleya linked a pull request Nov 11, 2020 that will close this issue
@baparham
Copy link

baparham commented May 11, 2021

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.

#800 (comment)

@rowleya
Copy link
Author

rowleya commented May 11, 2021

Yes, I agree that this would also work

@baparham
Copy link

baparham commented May 11, 2021

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

@rowleya
Copy link
Author

rowleya commented May 11, 2021

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.

@baparham
Copy link

Yeah, that sounds a bit more complicated now that you mention it. Perhaps #694 can provide some insight on adding the new option though?

@rowleya
Copy link
Author

rowleya commented May 11, 2021

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

@rowleya rowleya linked a pull request May 11, 2021 that will close this issue
@rowleya
Copy link
Author

rowleya commented May 11, 2021

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

@AllanOricil
Copy link

Up

@AllanOricil
Copy link

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>

@ddresslerlegalplans
Copy link

ddresslerlegalplans commented May 4, 2023

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?

@AllanOricil
Copy link

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

@ddresslerlegalplans
Copy link

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.

@AllanOricil
Copy link

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

@sdarwin
Copy link

sdarwin commented Jun 1, 2023

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.

@QuarkLarry
Copy link

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.

@ricardo-noyolalozano
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants