Introduction to Docker Images

Nihal Nalla
fiolabs-datascience
4 min readApr 30, 2020

If you are reading this post then I assume that you are familiar with a few things about containerization & docker technology. If not, please click on the below link to check out our blog on Containerization and Docker technology.

If you’re looking to create a Dockerfile, build a Docker Image, and run a Docker Container, jump to the below link:

So every application (mostly a python application if its a Data Science project) is built using the Docker platform on an existing base image.

Now the question arises — what are the different Image types? Which is the best image for a given use case?

The common types are UbuntuOS, centOS, Windows Server Core, and various programming language images.

“Containers are mostly built on a pre-existing images”

The most important thing to remember here is that containers do not have cross-platform freedom, i.e., the base image should be of the same OS kernel as that of the underlying Host OS on a Virtual Machine or a server.

“Containers are not cross platforms.”

Docker uses an underlying technology called “namespaces”, PID namespace( Process ID), the NET namespace (Managing Networking Interfaces), etc. This along with “control groups”, “file systems”, and “container format” are OS-specific. Containers use few of these OS-specific techs and hence are lightweight (eg: File System on Windows and Linux is different from each other). Hence it’s not advisable to run containers of one OS platform on another.

“They are light weight, fast and efficient.”

Docker Image Types

Alpine vs. Slim vs WindowsServerCore

Alpine: This is a minimal Docker image based on the Alpine Linux Project. These are much smaller compared to most other distributed images. Hence they are very lightweight. This is recommended when the final image size should be minimal. Most of the applications run just fine on Alpine images, but due to its unusual libraries, a few apps might not run and needs additional dependencies to be installed while building the Docker Image.

Slim: This is a headless package of OpenJDK installed. Many of the common libraries and java packages are missing when compared to Base Image. It’s not advisable to use in Data Science projects unless there is an extreme space constraint as even run-time compilers need to be installed for this.

WindowsServerCore: As the name suggests, these images are built on Windows Server Core. Hence, these can run only on Windows Server or OS.

Things to consider in a Base Image:

Stability: Select a base image that has Long Term Support, like Ubuntu-LTS or other stable releases.

Latest: Its always a good idea to use the latest programming language or OS as your base Image as they have bug fixes and increase performance, like python 3.x instead of 2.x

Libraries & Dependencies: Sometimes its advisable to use base images that have pre-installed dependencies. Like ‘Anaconda’ which supports a wide range of data science libraries or ‘Floydhub’ which has different frameworks like theano, tensorflow, keras and caffe pre-built. This approach speeds up your deployment process and also becomes seamless as most of the dependencies are well tested.

Few of the popular docker images for Data Science

  • Ubuntu 20.04 is one of the latest Linux images released in April 2020 and is the LTS version.
  • Python images like python:3.8-slim-buster is very good for most of the data science projects and has an uncompressed size of 180mb approx.
  • Floydhub and Anaconda also provide images with extensive libraries supporting them.

So this is a simple explanation about different Docker Images for Data Science, comment below for any questions and I will try to get back to you and let us know if this article helped you.

What are you waiting for?

We believe FIO Labs never fails to keep their promise when it comes to providing quality services. Our enterprise expertise and industry leadership mean you’re in safe hands.

If you are interested in learning more about what we do at FIO Labs or have some questions about this page, feel free to send us a message to contact@fiolabs.ai — we’d love to hear from you.

How to reach FIO Labs:

Leave a comment below | Book a FREE 30-min session for our on-going Pro Bono Services or Fill in our LinkedIn Form| Contact Us | About FIO Labs | Blog

--

--