You are not logged in.
I need to create a package which would put a Docker image on the system. I could just create the image, and include it in the package separately, but I'd really prefer for all the process to be done by `makepkg`, since this will play well with the package-building automation I'm working with, and, I think, will be just more elegant to include a Dockerfile in sources, rather than a huge binary archive.
Can you please advise what would be the better way to build a Docker image during the package build?
Last edited by blochl (2019-10-10 18:02:45)
Offline
I do not see any complication. You could build the image in `build` and in `package` you `install` the resulting image in `$pkgdir/path/to/my/image`. Unless I'm missing something...
Offline
I do not see any complication. You could build the image in `build` and in `package` you `install` the resulting image in `$pkgdir/path/to/my/image`. Unless I'm missing something...
The complication is that the user who builds it needs to be in the `docker` group, and the Docker daemon needs to run for that. You can't add the user who builds the package to a group, or launch the Docker daemon from the PKGBUILD, can you?
Offline
Can you use podman (podman-compose) to build the container? Or depending on your automation, create a script that first assembles the container image and then calls makepkg.
Edit: A PKGBUILD is just a bash script. Theoretically you could do anything that your build user is allowed to in there.
A dockerfile in a package isn't really elegant regardless of the method used. Either you have the complete binary image as a source file or alternatively only the docker file as a source which will result in fetching files during build() or prepare() instead of the usual download step
Last edited by progandy (2019-10-08 15:57:46)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
Thanks! Eventually I went for the separate script option, which prepares the image before makepkg.
a821, thanks - I didn't hear of Buildah, and indeed it looks like the tool for that. The problem is that now I have a Dockerfile, and although Buildah can work with them, it is not optimal, as the image becomes actually larger than with Docker, and all the tools for preparing the image are still on it. When I will get to optimizing this container build process, I'll likely switch to using Buildah.
Offline