The Zoo Animal Analogy of Docker You Never Knew You Needed

Fierro Labs
6 min readOct 30, 2023

--

AI generated image of a blue whale in an aquarium.

Just like a zookeeper cares for a diverse array of animals in distinct enclosures, Docker lets you nurture software applications in their own unique environments. In the world of modern software development, Docker has emerged as a revolutionary tool that simplifies the process of building, shipping, and running applications. Whether you’re a seasoned developer or a complete novice, this guide will demystify Docker and break down its core concepts in a beginner-friendly manner.

By the end of this journey, you’ll have a basic understanding of what Docker is and learn just another way to explain Docker to newbies. If you’re on Linux, you will even have an opportunity to run your own personal cloud on Docker!

What is Docker?

You may have heard of Docker in the past and that it’s some software for containerization. But what does that mean? Well. Let me explain. Docker is not a magical black box, but rather a platform that allows you to package and distribute applications, along with all their dependencies, in a consistent and efficient way. This ensures that your application behaves consistently no matter where it’s deployed.

Containerization is the core paradigm that enables this process of taking a piece of software and letting it run in its own microcosm. It’s like building a zoo where you choose the animals and assign them a habitat enclosure that they respectively thrive in best. This animal will continue to live there, until you happen to decide to move its enclosure, sell the zoo, or it dies! Anyways, something could still go wrong with it, but that’s beside the point. The animal has to live there now, and it is the zoo’s job to maintain the animal. And the animal cannot affect or influence the zoo, because it doesn’t have a means to break out and realistically that animal is replaceable. Morbid. I know.

AI generated image of sad monkeys in a zoo

Let’s substitute the word “enclosure” for “container” and instead of an animal being in it, it is software. And instead of the enclosure being maintained by a zoo, the container is maintained by a computer. Not only that, the computer was built by capitalists, so it also only provides the minimum resources that the container needs. This is what is meant by Docker containers being “light-weight” and that the software lives in its own little world.

Generally, containers are made to run only very specific tasks. As mentioned, this paradigm is a modern solution, commonly used in software engineering today.

How to Install Docker

Before we dive into the practical aspects, let’s start with setting up Docker on our machine. Installing Docker on our machine is like deciding in what region we want to open up our zoo. The zoo can be installed in various environments, and the enclosures are free to be run in any zoo.

AI generated image of giraffes in snowy weather

Anyways, the Docker installation process varies depending on your operating system. Docker offers a user-friendly installer for Windows, macOS, and various Linux distributions.

Shoutout to all my FxBlox owners who already have this installed and running by default.

For Windows, MacOS, and even Linux users, Docker Desktop is an easy-to-start choice. Simply download the installer from the official Docker website, run it, and follow the installation wizard. Once complete, Docker Desktop will be up and running, ready to manage your containers.

Linux users will find installation instructions tailored to their specific distribution on the Docker website. Commonly used Linux distributions like Ubuntu, Debian, and CentOS all have easy-to-follow installation guides.

How to Run a Container

With Docker installed, you’re ready to move your first animal into its enclosure! Containers are instances of Docker images, which are packages that include everything an application needs to run, from the code to the runtime, libraries, and system tools.

Images are like all-inclusive blueprints that detail everything about the animal like what they depend on to live, how they function, the space they need. This is necessary if you are going to be moving the poor sucker around the world sometimes.

Photo by C.Valdez on Unsplash

To run a container, you need to specify an image. Docker will download this image if it’s not already available locally. Let’s try running a basic container to get a feel for it. Open your terminal (command prompt for Windows users) and enter the following command:

docker run hello-world

This command tells Docker to run the “hello-world” container. Docker will fetch the image from its repository, execute it, and display a friendly greeting. It’s a simple example, but it demonstrates how easy it is to spin up a container.

How to Check Container Status

Of course, as any responsible zoo owner, you have to check the health of your animals and their enclosures. To check the status of running containers, you can use the following command:

docker ps

This will provide you with a list of currently running containers. It includes essential information like the container ID, image used, the command the container is running, and the status.

However, if you want to see all containers, including those that are not currently running, you can add the -aflag:

docker ps -a

This list will include containers that are stopped or have exited. You can identify containers by their unique IDs and names.

How to Start, Stop, and Restart a Container

Photo by Daiga Ellaby on Unsplash

Managing containers is a crucial part of working with Docker. To start a stopped container, use the docker startcommand followed by the container ID or name. For example:

docker start my_container

To stop a running container, use the docker stop command:

docker stop my_container

To restart a container, you guessed it, use the docker restart command:

docker restart my_container

Exercise (optional)

If you’re running a Linux OS and want to try your hand at deploying your own personal cloud you can check out this step-by-step tutorial:

Conclusion

Our journey has unveiled Docker as the ultimate zookeeper for software containers. These containers serve as microcosms, ensuring applications run consistently and efficiently, akin to animals thriving in their designated enclosures.

As diligent keepers of this digital zoo, we opened up our zoo by installing Docker; we moved in our first animals by downloading an image and running it in a container; and we monitored the health of our animals by checking container status.

Embrace the power of Docker as you delve deeper into its capabilities, making it an indispensable asset in modern software development, and remember, you’re not just a developer; you’re the zookeeper of your digital world.

Follow my YouTube channel for more web 3 content. Follow my Medium blog for more personal experience content and tutorials. Find me on X at @legendofmar. Checkout the Functionland Telegram for support and updates. Cheers!

All AI generated images were prompted by Fierro Labs on NightCafe.

--

--

Fierro Labs

Fierro Labs is a Web3 content and documentation creative studio. In this blog we talk about and make guides on IT and Web3 topics! Email: marco@fierrolabs.com