Different images in containers

I want to create separated containers with a single service in each (more or less). I am using the php7-apache image which seems to use a base image of debian:jessie, php7 and apache. Since apache and php in this case are pretty intertwined I don’t mind using this container.

I want to start adding other services to their own containers (git for example) and was considering using a tiny base image like busybox or alpinebox for these containers to keep image size down.

  • How to duplicate container using existing images
  • X11 forwarding of GUI app in Docker container
  • Can you have a docker copy in the same line as docker run
  • Is it better to build and test in a container?
  • Docker command to fetch dockerfile from registry
  • How do I use the “git-like” capabilities of Docker?
  • That said, I have read that using the same base image as other containers only gives you the ‘penalty’ of the one time image download of the base OS (debian jessie) which is then cached – while using tiny OSes in other containers will download those OSes on top of the base OS.

    What is the best practice in this case? Should I use the same base image (debian jessie) for all the containers in this case?

  • How do I create a PID trap for multiple commands separated by &&
  • docker-machine stop command kills all my containers
  • How do I start a php server in the background as a daemon in a docker container
  • I can't access mounted volume of docker-postgres from host
  • Docker fails in Visual Studio 2017, how do i get docker to run in VS2017
  • Publishing docker swarm mode port only to localhost
  • One Solution collect form web for “Different images in containers”

    You may want to create a base image from scratch. Create a base image from scratch.

    From docker documentation

    You can use Docker’s reserved, minimal image, scratch, as a starting point for building containers. Using the scratch “image” signals to the build process that you want the next command in the Dockerfile to be the first filesystem layer in your image.

    While scratch appears in Docker’s repository on the hub, you can’t pull it, run it, or tag any image with the name scratch. Instead, you can refer to it in your Dockerfile. For example, to create a minimal container using scratch:

    This example creates the hello-world image used in the tutorials. If you want to test it out, you can clone the image repo

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.