Docker Community Forums

Share and learn in the Docker community.

Pattern for docker?


(Cloudbluedigital) #1

Hi guys,

It is my first time creating docker images and therefore I have a question.

I want to create a custom docker for laravel testing.
This requires
Node
Mysql
Nginx
PhP

Now what I wanted to do is create a docker for each one, 1 docker for mysql, 1 for node etc and then combine it into full laravel docker image

I believe this will allow me to reuse basic images for another docker image, i.e if I would need one for node I would go mysql+node= my node image.

So here’s the question is it a good approach to do it that way? I mean all of them will have Ubuntu on top of them so I fill like I will be repeating myself or is it better to do one big image containing all the features? Thanks for help and I hope you understand what I mean


(Sam) #2

an image is a standalone thing

combine means either

  1. run separate containers, with connections between them
  2. build the 1st 'from ubuntu’
    build the second 'from 1st’
    build the 3rd from second

I don’t know why you would do either of these

just build your image as if you were installing it together…
unless you need the database to be persistent regardless of the app( node/php/nginx)
then just USE the mysql base image already in the catalog,
you may be able to find an nginx/php that u can add node to…