What is the best way to automate the deployment of a Docker image in a CI environment?
After building a simple web project using Travis CI and using a Dockerfile
to build the corresponding Docker image, is there a way to automatically cause that image to be deployed to a cloud provider?
Right now, the Dockerfile pulls down the base image to the Travis build machine and builds the image based on the instructions in the Dockerfile. At this point if the build is successful I can push it to the Docker Hub, though I have no need save this image to the Docker hub, what I envision is deploying the successfully built Docker image to a cloud provider (IE. DigitalOcean, Linode, or AWS) and starting/running the image.
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).
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments