Docker for efficient development
Lesson 1 - Containers
Welcome to this quick tutorial where we dive into the basics of containers and how they work. Ready? Let’s go!
- Step 1: Understand What a Container Is
A container is a lightweight, standard software package that bundles your application code and all its dependencies.
This means your app will run fast and reliable anywhere — not just “on my machine,” but on any machine. - Step 2: Containers vs. Virtual Machines (VMs) — What’s the Difference?
- Virtual Machine: Think of it as a full computer inside your computer — it has its own CPU, memory, disk, and operating system.
- Container: It’s more like a process running on your host system but in a restricted, isolated environment, built from a pre-made image.
- Step 3: Why Are Containers Awesome?
- Containers are layered on a file system, saving tons of space.
- You only download an image once (like SQL Server) and can spin it up as many times as you want.
- They share the host OS and libraries, which means:
- Much faster deployment
- Less overhead
- Easier migration between environments
- Step 4: How Does This Look in Practice?
- Say you want to install SQL Server for multiple clients:
- With VMs, you create a full virtual machine per client (OS + SQL Server), which is slow and takes lots of resources.
- With containers, you download the SQL Server image once and deploy multiple isolated containers from the same image — way simpler and faster!
- Step 5: What’s Docker’s Role?
- Docker made containers popular by turning the Linux kernel feature into a user-friendly tool. They teamed up with Microsoft to bring containers to Windows too.
- As of 2022, Docker hosts over 9.6 million images!
- There are other container systems out there, but Docker remains the standard.
- Step 6: How Much Space Does Docker Need?
- Docker itself takes about 400 MB to install.
- After that, you only use space for the images you download.
- Containers not running don’t consume space or resources — just like VMs, you can spin them up and down as needed.
- Step 7: Resource Control, you’re the Boss
- Since containers are just processes, they use as many resources as needed — but you can limit CPU and memory usage to keep everything balanced.
Up next: We’ll deploy our very first container and explore Docker Compose. Stay tuned!