Different Distros
Part of the Introduction to Docker section of Coddy's Terminal journey — lesson 9 of 40.
Each image carries its own filesystem, so the same command can give different results depending on the image you run it in. A great example is /etc/os-release, a file every Linux distribution uses to describe itself:
docker run alpine cat /etc/os-releaseRun inside alpine, this file says Alpine Linux. Run the very same command inside ubuntu:
docker run ubuntu cat /etc/os-releaseand it says Ubuntu instead. The files genuinely differ because each image really ships a different operating system.
Challenge
BeginnerRead the /etc/os-release file inside an ubuntu container with cat and confirm it identifies as Ubuntu.
Cheat sheet
Each Docker image carries its own filesystem. The same command can produce different results depending on the image:
docker run alpine cat /etc/os-release # prints Alpine Linux
docker run ubuntu cat /etc/os-release # prints Ubuntu/etc/os-release is a standard Linux file that describes the OS distribution of the image.
Try it yourself
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Introduction to Docker
3Running Containers
Running A CommandReal ExecutionDifferent DistrosAuto-Remove ContainersRecap - Container Runner