In partnership with

Today, you will learn the basics of Docker.

StackOverflow called it one of the most universally used tools this year.

Developers are obsessed with it.

But why? Is it that useful?

Why Docker

Imagine this.

You have a working Python code on your computer.

You send it to a friend.

But for some reason

What happened?

You found out that he's still using Python 2!

The code that works on your machine COULD FAIL, just because it’s in another environment.

Aka the “it works on my machine problem.”

Docker fixes that by packaging your code into containers.

Docker Containers

Containers are like mini computers.

It contains everything your program needs.

So your code runs the exact same way on any machine.

A container isn’t something magical. It’s just a process running on your computer that has its own filesystem, network, etc.

Basic Docker Workflow

To make a container, first create a Dockerfile (the filename is literally Dockerfile).

Inside, specify everything required to run your code.

Python 3.11, a Linux-based environment, command: “python main.py”

You could just send your friend the file & your code and tell him to build a container based on that.

But there's a better way: build a Docker Image.

A Docker image is a static, shareable version of your environment.

It’s very easy to create, just run this command:

docker build -t my_app .

After you share the image, your friend can run your code easily by creating a container.

He doesn't even have to install Python. He just has to run one command:

docker run my_app

Docker will create a container on his computer based on the image.

Now your code works on his machine, or any other.

Fee from Anime Coders

The Tech newsletter for Engineers who want to stay ahead

Tech moves fast, but you're still playing catch-up?

That's exactly why 100K+ engineers working at Google, Meta, and Apple read The Code twice a week.

Here's what you get:

  • Curated tech news that shapes your career - Filtered from thousands of sources so you know what's coming 6 months early.

  • Practical resources you can use immediately - Real tutorials and tools that solve actual engineering problems.

  • Research papers and insights decoded - We break down complex tech so you understand what matters.

All delivered twice a week in just 2 short emails.

How did you like today's email?

Login or Subscribe to participate

Keep Reading

No posts found