https://github.com/Wowu/docker-rollout Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code + Explore + All features + Documentation + GitHub Skills + Blog * Solutions + For + Enterprise + Teams + Startups + Education + By Solution + CI/CD & Automation + DevOps + DevSecOps + Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles + Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} Wowu / docker-rollout Public * Notifications * Fork 3 * Star 137 Zero Downtime Deployment for Docker Compose github.com/wowu/docker-rollout License MIT license 137 stars 3 forks Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Security * Insights More * Code * Issues * Pull requests * Actions * Security * Insights Wowu/docker-rollout This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 1 branch 1 tag Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/W] Use Git or checkout with SVN using the web URL. [gh repo clone Wowu/d] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @Wowu Wowu docs: update nginx-proxy example ... cc83ea1 Feb 6, 2023 docs: update nginx-proxy example cc83ea1 Git stats * 18 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github/workflows ci: add docker-rollout to additional_files February 6, 2023 22:12 examples docs: update nginx-proxy example February 6, 2023 23:20 .editorconfig Add first script version February 6, 2023 21:47 LICENSE Add README and LICENSE February 6, 2023 21:47 README.md docs: fix README February 6, 2023 23:17 docker-rollout docs: add nginx-proxy example February 6, 2023 23:16 View code [ ] docker rollout Zero Downtime Deployment for Docker Compose Features Installation Usage [?][?] Caveats Sample deployment script Why? License README.md docker rollout Zero Downtime Deployment for Docker Compose Docker CLI plugin that updates Docker Compose services without downtime. Simply replace docker compose up -d with docker rollout in your deployment scripts. This command will scale the service to 2 instances, wait for the new container to be ready, and then remove the old container. * Features * Installation * Usage + [?][?] Caveats + Sample deployment script * Why? * License Features * [?] Zero downtime deployment for Docker Compose services * Works with Docker Compose and docker-compose * [?] Supports Docker healthchecks out of the box Installation # Create directory for Docker cli plugins mkdir -p ~/.docker/cli-plugins # Download docker-rollout script to Docker cli plugins directory curl https://raw.githubusercontent.com/wowu/docker-rollout/master/docker-rollout -o ~/.docker/cli-plugins/docker-rollout # Make the script executable chmod +x ~/.docker/cli-plugins/docker-rollout Usage Run docker rollout instead of docker compose up -d to update a service without downtime. $ docker rollout -f docker-compose.yml Options: * -f | --file FILE - (not required) - Path to compose file, can be specified multiple times, as in docker-compose. * -t | --timeout SECONDS - (not required) - Timeout in seconds to wait for new container to become healthy, if the container has healthcheck defined in Dockerfile or docker-compose.yml. Default: 60 * -w | --wait SECONDS - (not required) - Time to wait for new container to be ready if healthcheck is not defined. Default: 10 See examples in examples directory for sample docker-compose.yml files. [?][?] Caveats * Currently only services with scale 1 are supported. * Your service cannot have container_name and ports defined in docker-compose.yml, as it's not possible to run multiple containers with the same name or port mapping. Use a proxy as described below. * Proxy like Traefik or nginx-proxy is required to route traffic. * Each deployment will increment the index in container name (e.g. project-web-1 -> project-web-2). Sample deployment script Sample deployment script for web service: # Download latest code git pull # Build new app image docker compose build web # Run database migrations docker compose run web rake db:migrate # Deploy new version docker rollout web Why? Using docker compose up to deploy a new version of a service causes downtime because the app container is stopped before the new container is created. If your application takes a while to boot, this may be noticeable to users. Using container orchestration tools like Kubernetes or Nomad is usually an overkill for projects that will do fine with a single-server Docker Compose setup. Dokku comes with zero-downtime deployment and more useful features, but it's not as flexible as Docker Compose. If you have a proxy like Traefik or nginx-proxy, a zero downtime deployment can be achieved by writing a script that scales the service to 2 instances, waits for the new container to be ready, and then removes the old container. docker rollout does exactly that, but with a single command that you can use in your deployment scripts. If you're using Docker healthchecks, Traefik will make sure that traffic is only routed to the new container when it's ready. License MIT License (c) Karol Musur About Zero Downtime Deployment for Docker Compose github.com/Wowu/docker-rollout Topics docker deployment docker-compose Resources Readme License MIT license Stars 137 stars Watchers 3 watching Forks 3 forks Releases 1 docker rollout v0.1 Latest Feb 6, 2023 Languages * Shell 100.0% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.