Learn Docker With My Newest Course

Dive into Docker takes you from "What is Docker?" to confidently applying Docker to your own projects. It's packed with best practices and examples. Start Learning Docker →

Docker Tip #34: Should You Use Docker Compose in Production?


It's finally time to deploy your app to production. There's a few Docker related tools to choose from, but will Compose work?

Docker Compose is very suitable for production, if you’re deploying to 1 host. Let’s face it, not every application needs to scale to infinity and beyond with multiple forms of redundancy.

Depending on what you’re building, you can serve hundreds of thousands or millions of requests per month on a single server and Docker Compose makes it very easy to get up and running. Scaling vertically can go a long ways.

Of course this simplicity comes at a small price. With no load balancers in place, then you will experience a few seconds of down time on every deploy. But that’s a reasonable price to pay for a lower complexity / cost solution.

When it comes time to deploying your application to production all you have to do is run docker-compose up -d to run Compose in the background and you’re good to go.

If you set up restart policies on your containers then they will automatically come up if they crash, or if you reboot your server. That’s a pretty sweet deal.

If the above is not acceptable to you then you should look into using Docker Swarm or Kubernetes for deploying and scaling to multiple hosts.

Free Intro to Docker Email Course

Over 5 days you'll get 1 email per day that includes video and text from the premium Dive Into Docker course. By the end of the 5 days you'll have hands on experience using Docker to serve a website.