minimal centos-based Docker image with bash, ssh, wget, etc. in 16 Mb, using minicon

by c4lf4
GNU/Linux ◆ xterm-256color ◆ bash 6752 views

This asciinema describes the procedure of creating a minimal Docker image that contains commands such as bash, ssh, wget, etc. from a centos:latest Docker image. The result is that the image will have a size of only 16Mb, instead of the 362 Mb. from the original Docker image.

The asciicast content

  1. Checking that the user can run docker containers.
  2. Getting the centos:latest image
  3. Creating one container and tests it (verifies that it does not have wget, nor ssh, etc.).
  4. Building one image with wget, ssh, ip, etc. using a Dockerfile (called minicon:ex1fat).
  5. Verify the size of the new image.
  6. Check that the image has the new commands (run a container and issue commands).
  7. Use minicon to create the minified image (minicon:ex1): include –apt dependencies, include example executions of the commands that we want to keep (-E ‘ping -c 1 www.google.es’).
  8. Verify the size of the new image: 10.9Mb.
  9. Check the new image (minicon:ex1) and see that it has the requested commands, but only these commands.