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.

  • When running Docker on Raspberry Pi starting containers fails from time to time
  • How to deploy a Rails app with GitLab CI + Docker + Ansible?
  • Installing Docker on OpenSuse Linux
  • How to retrieve metrics from Postfix in Docker Container
  • apt-get in docker behind corporate proxy
  • my daemon docker container doesnt stay running
  • 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?

  • Install MongoDB and Tomcat using Dockerfile
  • How to connect docker in VM of VMware Player
  • Docker Ip Failover
  • Unable to connect to server when running docker django container?
  • Running Windows Server Core in Docker Container
  • Docker-Compose WordPress MySql Can't Connect
  • 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.