0

I use MariaDB and Adminer. Both of them have their official images.

For the purpose of consistency, our team has these custom-built images:

  • company/site
  • company/api
  • company/panel

We want to have our company/database. We want to have an image that has both MariaDB and Adminer inside it.

Is there a way for us to merge these two images into one image?

Big boy
  • 1,113
  • 2
  • 8
  • 23
  • When by "possible" you mean "haven an image with mariadb and adminer", then certainly, yes. Best case, you extend the `mariadb`-image with a self-written containerfile and install adminer through whatever package manager the underlying distribution uses (or start from adminer and install mariadb). When you mean "have two `FROM`s in a single image" , then no. --- Why do you want to have adminer in the same container as mariadb? Why not two separate containers? – Turing85 Jan 05 '23 at 03:37
  • @Turing85, not in the same container, in the same image. We want to spawn two containers, but from the same image. And the reason is only for consistency (huge benefit for team and knowledge sharing) – Big boy Jan 05 '23 at 03:38
  • @Turing85, I know I can start from one image and install the other manually. But that means that I would be on my own, not on the official path. I want to have the official distribution of both of them. – Big boy Jan 05 '23 at 03:39
  • This is an antipattern and a security risk; only install software in a container that is needed. I also do not see what knowledge sharing benefits there are. As-is, we can use both official images for mariadb and adminer, not care about maintenance (though I would still recommend running security scans on them) and be done. – Turing85 Jan 05 '23 at 03:39
  • @Turing85, not for the production environment. In production we stick to the most lean docker image and we only deploy on official images. But in the development environment, it helps. – Big boy Jan 05 '23 at 03:43
  • 1
    Again, antipattern. You reduce dev/prod parity. The development environment should be as close as possible to the production environment as possible. I still do not understand what benefit you hope to achieve by packaging the database and an the admin tool into the same image. Is it the underlying OS you are concerned about? – Turing85 Jan 05 '23 at 03:50
  • 2
    I agree this is an antipattern. 100% you can do it easily. You can use a "muti-stage build" to copy the contents of one image into another. The odds that it results in either app working correctly are practically zero. You certainly wouldn't be on anything like an "official path" with the results. Think about it from the maintainer's point of view: Docker is handy to them as developers because they control exactly what's in the image when their software runs. You want to throw that out completely for nebulous reasons, and they're supposed to consider it official? – Matt Blaha Jan 05 '23 at 04:03
  • @Turing85, that `dev/prod parity` was a very solid and convincing argument. Thank you so much for giving me insights. – Big boy Jan 05 '23 at 05:44

0 Answers0