shouldenough

DevOpsLearn Docker by Dockerizing Your App

Lesson 10 of 10

Lesson 10/8 minutes/1 graded

The Docker workflow, end to end

Where Docker sits in a real team: local development, a CI build, a private registry, and a server that pulls the image and runs it.

Everything so far has been one machine and one command at a time. Here is where those pieces sit in the way a team actually works, because that is the bit that turns a pile of commands into something you can reason about.

On your machine

You are building a JavaScript app that needs MongoDB. You do not install Mongo. You pull the official image from Docker Hub, run it as a container, bind its port, and point your app at localhost. Your app runs on your machine as usual, outside a container, because that is more comfortable while you are still editing files every minute.

That alone is most of the value for a developer. No database install, no version fight, and the same one command for the next person who joins.

When you push code

You commit and push. Your CI server, Jenkins or GitHub Actions or whichever one your team uses, picks it up and does two things: it builds the app, then it builds a Docker image from it, the same docker build you ran by hand.

Then CI pushes that image to a private registry, because your company's app is not going in a public one. It gets a tag, and now there is one artifact holding your code and everything it needs.

On the server

The server pulls. Your app image comes from the private registry, so the server runs docker login once for that registry, and MongoDB comes from Docker Hub just like it did on your laptop. Two containers, running side by side, talking to each other.

Nobody installed Node on that server. Nobody followed a setup document. The server needed Docker, a login, and two image names.

Then a tester opens the app on that server and tests the thing you built, in the same image that will go to production later. That is the part that removes the "works on my machine" argument for good, because it really is the same image.

The order, in one list

Pull images you depend on, develop against them. Commit. CI builds your image and pushes it to a registry. The server pulls it and runs it. Test what the server is running.

Nothing in that chain is a Docker feature you have not already used in this course. It is the same five or six commands, moved onto other machines.

What I left out

This was the foundation, not the whole tool. When you keep going, these are the next three things worth learning, in this order.

Docker Compose, for describing several containers in one file instead of remembering a long docker run line for each. Volumes, for data that has to outlive a container, which is the gap I pointed at when we removed containers. Networks, for how containers find each other by name rather than by port on your host.

After those, orchestration, meaning Kubernetes and friends, but only once you have containers you are actually running.

Check yourself

Knowledge check2 questions
Question 1 of 2
What does CI hand over to the server in this workflow?