title: Docker-compose.yml file that builds a base image, then children based on it?
body: <p>For clarification, when I say base image, I mean the parent image that has all the common configurations, so that the children based on it don't need to download the dependencies individually.</p>
  
  <p>From my understanding, docker-compose.yml files are the run-time configurations, while Dockerfiles are the build-time configurations. However, there is a <code>build</code> option using docker-compose, and I was wondering how I could use this to build a base image.</p>
  
  <p>As of right now, I use a shellscript that runs other shellscripts. One builds all my images, from a base image that it also creates. The other runs them as containers with the necessary configurations. However, the base image is never ran as a container.</p>
  
  <p>Currently, the shellscript I hope to change into a docker-compose file, looks like so:</p>
  
  <pre><code>echo "Creating docker network net1"
  docker network create net1
  
  echo "Running api as a container with port 5000 exposed on net1"
  docker run --name api_cntr --net net1 -d -p 5000:5000 api_img
  
  echo "Running redis service with port 6379 exposed on net1"
  docker run --name message_service --net net1 -p 6379:6379 -d redis
  
  echo "Running celery worker on net1"
  docker run --name celery_worker1 --net net1 -d celery_worker_img
  
  echo "Running flower HUD on net1 with port 5555 exposed"
  docker run --name flower_hud --net net1 -d -p 5555:5555 flower_hud_img
  </code></pre>
  
  <p>The shellscript that makes the images, is as follows:</p>
  
  <pre><code>echo "Building Base Image"
  docker build -t base ../base-image
  
  echo "Building api image from Dockerfile"
  docker build -t api_img  ../api
  
  echo "Building celery worker image"
  docker build -t celery_worker_img ../celery-worker
  
  echo "Building celery worker HUD"
  docker build -t flower_hud_img ../flower-hud
  </code></pre>
  
  <p>My questions comes down to one thing, can I create this Base image without ever running it in a container with docker-compose. (All the Dockerfiles start with <code>FROM base:latest</code> other than the base itself). I'm looking to make it as easy as possible for other people, so that they only have to run a single command.</p>
  
  <p>EDIT: I am using version 3, and acording to the docs, <code>build:</code> is ignored, and docker-compose only accepts pre-built images.</p>