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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-pull images required for Docker Compose image builds - including authenticated pulls #2201

Merged
merged 4 commits into from Apr 5, 2020

Conversation

rnorth
Copy link
Member

@rnorth rnorth commented Dec 20, 2019

So that ImageFromDockerfile and Docker Compose can use images from authenticated registries when building temporary images.

This PR again involves very light parsing; this time adding just enough parsing of Dockerfiles to ensure that images are pre-pulled, and also to discover such Dockerfiles when they're part of a compose build.

This completes our coverage for authenticated pulls - all of the following should now work:

  • plain old GenericContainer(someAuthenticatedImage)
  • ImageFromDockerfile that includes one/more FROM someAuthenticatedImage lines. EDIT: post release, I found a bug with this which will be fixed shortly
  • docker-compose.yml files that point to an image via image: someAuthenticatedImage
  • docker-compose.yml files that include build: someDockerfile where the dockerfile includes one/more FROM someAuthenticatedImage lines

I think the parsing is simple enough, and solid enough, that it should work in all cases. However, it should also do no harm if there is ever an exotic new way to identify docker image names in Dockerfiles/compose files.

Fixes #1799

So that ImageFromDockerfile and Docker Compose can use images from authenticated registries when building temporary images

Fixes #1799
@@ -2,5 +2,3 @@ redis:
image: redis
mysql:
image: mysql
custom:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please clarify why it was removed? :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I think I was trying to make sure the tests only tested one thing (we have other test cases and other example compose files that cover the build scenario).

Still, I now think I'll restore it to how it was, to give us better coverage for v1 compose files.

@rnorth rnorth merged commit 4c3bbd6 into master Apr 5, 2020
@rnorth rnorth deleted the fix-1799-prefetch-build-images branch April 5, 2020 06:11
@bsideup bsideup added this to the next milestone Apr 12, 2020
@rnorth rnorth changed the title Pre-pull images required for Dockerfile/Compose image builds Pre-pull images required for Docker Compose image builds - including authenticated pulls Apr 13, 2020
@rnorth
Copy link
Member Author

rnorth commented Apr 13, 2020

quincy pushed a commit to quincy/testcontainers-java that referenced this pull request May 28, 2020
…tainers#2201)

* Pre-pull images required for Dockerfile/Compose image builds
So that ImageFromDockerfile and Docker Compose can use images from authenticated registries when building temporary images

Fixes testcontainers#1799

* Restore wider test scope
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ImageFromDockerfile does not support authenticated pulls
3 participants