My first year with Docker was mostly copy and paste. A README said docker run -d -p 5432:5432 postgres , I ran it, Postgres showed up, and I moved on. When something broke I searched the error, pasted whatever fixed it for someone on Stack Overflow, and hoped.
That works until the day a container won't start, your disk is full of images you've never heard of, and a teammate asks why the app can't reach the database. Then you find out you know a lot of commands and almost none of the model underneath them.
What finally helped was learning Docker in a different order than most tutorials teach it.
Start with the two nouns
Nearly every confusing moment I had came from mixing up images and containers.
An image is a read-only snapshot of a filesystem plus some metadata, like which command to run by default. A container is a running (or stopped) process started from that image, with its own thin writable layer on top. You can start ten containers from one image. Deleting a container doesn't touch the image.…