0

I have a couple of custom docker images i.e

cloudbluedigital/mysql:v-0.1
cloudbluedigital/redis:v-0.1

I am now using those images to build laravel image, so in my docker file I have:

FROM cloudbluedigital/ubuntu:v-0.2
FROM cloudbluedigital/php:v-0.2
FROM cloudbluedigital/node:v-0.1
FROM cloudbluedigital/mysql:v-0.1
FROM cloudbluedigital/redis:v-0.1

MAINTAINER cloudbluedigital version: 0.1

All good and builded, however when I run my new laravel image, I can start redis-server from redis image however mysql command is not found, I have checked mysql image and it is installed there but on my new laravel image it is not installed. Anyone knows why this is happening? Is that a correct setup and is worth ignoring some folders with additional configuration? (I am only using Dockerfile, complete newbie)

1 Answer 1

2

You are using a Multistage build Dockerfile. So your Dockerfile

FROM cloudbluedigital/ubuntu:v-0.2
FROM cloudbluedigital/php:v-0.2
FROM cloudbluedigital/node:v-0.1
FROM cloudbluedigital/mysql:v-0.1
FROM cloudbluedigital/redis:v-0.1

MAINTAINER cloudbluedigital version: 0.1

Is actually equivalent to

FROM cloudbluedigital/redis:v-0.1

MAINTAINER cloudbluedigital version: 0.1

Specifying multiple FROM is only for building artifacts and copying in the final FROM. Read below for more details

https://docs.docker.com/engine/userguide/eng-image/multistage-build/

You need to use docker-compose to run multiple services. Read more details about the same on below

https://docs.docker.com/compose/compose-file/

Sign up to request clarification or add additional context in comments.

5 Comments

okay, I will read those url shortly, meanwhile can you provide me with at least an example of how to configure this? This thing that got me worried is that redis image is pulling ubuntu image but when I was using docker push command it pushed redis image but loaded from cache php image?
You want everything in same image or run different services? Because install everything in same image means you need to install each software
I want to have software installed on other services i.e all the images available in my cloudbluedigital/laravel image, think of it as having services spread out and having laravel image as a main general one that has everything, this allows me to split some logic, If I only need mysql and redis for particular project I can just use those 2 images
You are reinventing the wheel, please look at github.com/laradock/laradock
not only it contains a lot of stuff that we don't need and doesn't have the stuff that is needed. We need our custom docker

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.