Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker continuous deployment workflow

I'm planning to set up a jenkins-based CD workflow with Docker at the end. My idea is to automatically build (by Jenkins) a docker image for every green build, then deploy that image either by jenkins or by 'hand' (I'm not yet sure whether I want to automatically run each green build).

Getting to the point of having a new image built is easy. My question is about the deployment itself. What's the best practice to 'reload' or 'restart' a running docker container? Suppose the image changed for the container, how do I gracefully reload it while having a service running inside? Do I need to do the traditional dance with multiple running containers and load balancing or is there a 'dockery' way?

like image 219
Csaba Okrona Avatar asked Dec 23 '13 06:12

Csaba Okrona


People also ask

Is Docker used for continuous deployment?

Docker has become an early adopter in Continuous Integration and Continuous Deployment. By leveraging the right integration with source code control mechanism such as GIT, Jenkins can initiate a build process each time a developer commits his code.

How do you use Docker in CI CD pipeline?

How to implement a CI/CD pipeline in the codebase using a CircleCI config file in the project. Building a Docker image. Pushing the Docker image to Docker Hub. Kicking off a deployment script which will run the application in Docker container on a Digital Ocean server.

What is Docker DCT?

Docker Content Trust (DCT) provides the ability to use digital signatures for data sent to and received from remote Docker registries. These signatures allow client-side or runtime verification of the integrity and publisher of specific image tags.


1 Answers

Suppose the image changed for the container, how do I gracefully reload it while having a service running inside?

You don't want this.

Docker is a simple system for managing apps and their dependencies. It's simple and robust because ALL dependencies of an application are bundled with it. If your app runs today on your laptop, it will run tomorrow on your server. This is because we have captured 100% of the "inputs" for your application.

As soon as you introduce concepts like "upgrade" and "restart", your application can (accidentally) store state internally. That means it might behave differently tomorrow than it does today (after being restarted and upgraded 100 times).

It's better use a load balancer (or similar) to transition between your versions than to try and muck with the philosophy of Docker.

like image 55
BraveNewCurrency Avatar answered Sep 29 '22 05:09

BraveNewCurrency