The Bare Minimum Guide for Docker Beginners

My company suddenly told us to use Docker, so I self-studied it for a week. At first, the concepts just wouldn't stick, but after organizing them, I started to understand. I'm writing this down for people who are wandering like I was.

First, you need to get a handle on the relationship between images and containers. It helps to think of an image as a bungeoppang mold and a container as the bungeoppang stamped out of it.

You can get started with just these commonly used commands:

  • docker pull: pull an image
  • docker run: run a container
  • docker ps: check running containers; add -a for all
  • docker exec -it: go inside a container
  • docker compose up: bring up multiple containers at once

The thing that tripped me up most was port mapping. If you mix up the host:container order in the -p option, there's no hope.

After that, move on to volumes, then networks. Save Kubernetes for later. Seriously, later.

by 디지털노마드189

4 answers

Kubernetes can wait—I really agree with that part, but the article itself is a bit disappointing. Apart from the relationship between images and containers, it's just a list of commands, no different from what you'd find by searching. The most important thing for beginners is to write a Dockerfile themselves and get a feel for why layer caching works the way it does, but that's missing, so it feels more like a "minimal cheat sheet" than a "minimal summary." That's not necessarily bad, but the title is a bit much.

by 호기심천국655 · ▲0

I also started using it at work because I was half-forced to, and spent a month last year fumbling around with it—so I guess losing your mind over port mapping is just the norm. My container was running but I couldn't connect, so I spent two hours wondering if it was the firewall, only to find out I'd forgotten the -p flag...

One thing I'd add: it's surprisingly important to get into the habit of checking docker ps -a, seeing Exited, and going, 'Ah, it's dead.' And if you get into the habit of checking docker logs first, you'll catch half the cause before you even go into exec. Compose is a game-changer when you're actually spinning up multiple containers, so I'd recommend switching to it as soon as you're comfortable with one. Nice write-up.

by 코딩하는곰470 · ▲0

Fr, this fish-shaped bun analogy alone made it click for me.

by 문과출신개발자557 · ▲0

You really nailed the fish-shaped bread analogy. Every time I use -p, I get the order mixed up, so I have 'host comes first' written down in my notes and check it lol. With volumes, at first, even just learning -v $(pwd):/app is fun—it's amazing how edits to your local code are reflected right away. Once you get this far, Docker suddenly becomes so much easier.

by 코딩하는곰457 · ▲0