Learn Docker With My Newest Course

Dive into Docker takes you from "What is Docker?" to confidently applying Docker to your own projects. It's packed with best practices and examples. Start Learning Docker →

Docker Tip #4: Does Your Docker Image OS Need to Match Your Host OS?


Your Docker Image OS is what you have defined in your Dockerfile and your host OS is what you're running Docker on. They can be different.

I’ve seen a lot of people ask the question “If my Docker host is running Ubuntu does that mean my Docker images need to be based on Ubuntu too?”.

The answer to that is no way. You can use whatever base image you want for your Docker images.

In fact, most “official” Docker images are based on the Alpine distribution of Linux. It’s completely fine to use that along with an Ubuntu, Debian, CentOS, RHEL or whatever other distro you prefer on your Docker host (aka. the machine running Docker).

Free Intro to Docker Email Course

Over 5 days you'll get 1 email per day that includes video and text from the premium Dive Into Docker course. By the end of the 5 days you'll have hands on experience using Docker to serve a website.