Continuous Deployment Using Travis CI and Docker Continuous Deployment Using Travis CI and Docker docker docker

Continuous Deployment Using Travis CI and Docker


While pushing directly to a host might seem ideal, I think it ignores the fact that hosts can fail, or may need to be replicated.

If you push directly to a prod host, and that host goes down, you don't have any way to start another one without re-running the entire CI pipeline.

If you push to an intermediary (the hub or a docker registry), you can create as many hosts as you want without having to re-run the build. You can also recover on a new host very easily (the initialize script can just pull the image and start).

If you wanted to, you could run your own registry on the cloud provider (instead of using the hub).


For a static website, you might want to look at Surge.

Otherwise, you might want to look at the AWS Elastic Beanstalk Command Line Interface (AWS EB CLI) in combination with using docker with AWS EB.

For using docker with AWS EB, read this AWS Blog post

For AWS EB CLI, here is an excerpt from the AWS EB dashboard sidebar

If you want to use a command line to create, manage, and scale your Elastic Beanstalk applications, please use the Elastic Beanstalk Command Line Interface (EB CLI). Get Started

$ mkdir HelloWorld$ cd HelloWorld$ eb init -p PHP$ echo "Hello World" > index.html$ eb create dev-env$ eb open

To deploy updates to your applications, use ‘eb deploy’.

Further reading


I had this very same question.

There's a very cool docker image called Watchtower that checks the running version of a container with the same image tag on Docker hub. If there is an update on the hub, Watchtower pulls the newer image and restarts the running container (retaining all the env vars etc). Works really well for single containers that need updating.

NB: it really is as simple as running:

docker run -d \--name watchtower \-e REPO_USER="username" -e REPO_PASS="pass" -e REPO_EMAIL="email" \-v /var/run/docker.sock:/var/run/docker.sock \drud/watchtower container_to_watch --debug

I'm looking for the same thing but for the containers running as part of a docker swarm...