in my GitHub Action Workflow I am starting various containers with docker-compose. This costs me tremendous 20 minutes, because it has to pull the docker images in the first place - on every single run. So it is really important for me to get the containers or at least the used images (e.g. nginx:alpine or mariadb:latest) cached!
The only solution that can be found on the internet seems to be this action from the GitHub marketplace: whoan/docker-build-with-cache-action.
And let me tell you I have played with it A LOT. Like weeks… And it did actually pull the images from cache at some point, but not as I needed it… it did not work out let’s say! This might be because I really do not understand how this action works. It is just working very different than I would expect!
How I expect the docker-build-with-cache-action to work:
I define the image nginx:alpine to be cached. Is this image used in a Dockerfile or to build a container, pull it from cache (or not at all, just use it (depending on how it works)). Pull it from public docker registry first, if it does not exist in the cache yet.
How it works or what I don’t understand:
- Docker registry credentials are required.
My username and password to a docker registry are required fields when using the action. How that? I do not want to push any images nor do I pull from private repositories. How is this required and not optional?
- It will look for a Dockerfile.
When trying to use this action, it will always look for a Dockerfile to build the image. And I don’t understand that. nginx:alpine is already a very valid docker image on itself. I am using it in a Dockerfile as a basis to build my actual container, but this is none of the action’s business?
I have really tried to work around with 1 and 2 but it would get a total mess, not make any sense with the idea of a docker-compose.yml and not work at the end. It seems that there are some deep misunderstandings for me using this action, because I seem to be the only one questioning this. Also I am still a beginner when using docker.
Thanks in advance. I really hope I’m getting answers to this. I’d appreciate it.