Adopting Docker containers is a great way to help speed software delivery. But there are different ways to go about Dockerizing your app. They don’t all offer the same degree of value.
To get the most out of Docker, it’s important to build Docker directly into your Continuous Delivery (CD) workflow. That’s different than simply building your app, then containerizing it after the code is written and tested.
In other words, there are two main ways to Dockerize your app. One is to make Docker a core part of your CD workflow. The other is to use a CD pipeline to write, test and deliver software, but wait until your code is at the delivery stage before writing a Dockerfile and moving your code to a container.
This post discusses why the difference between these two approaches is important. It also explains how to integrate Docker directly into your CD pipeline in the most efficient way.
CD pipelines and DevOps advantages
To understand why direct Docker integration into the CD pipeline matters, you first need to appreciate the reasons why a DevOps-inspired CD workflow delivers value.
The DevOps movement, which encourages CD, prioritizes several core principles that make software development and delivery more efficient. They include:
- Early testing. This is important because if you wait too long to test your code, you could find problems that force you to back peddle. That’s inefficient.
- Continuous rollout of new code. Rather than making changes to an app incrementally and dumping them on testers and users all at once, it’s more efficient to introduce smaller changes on a continuous basis.
- Constant communication. Software development and delivery works best when the teams responsible for the various parts of the process—from coding and testing to production deployment and administration—are in easy and constant communication with one another.
Getting the most from Docker
The way you work Docker into your workflow affects the extent to which Docker will help you achieve the advantages outlined above. By making Docker a core part of your CD pipeline, you ensure that:
- You can perform Docker-native testing as part of your CD workflow. That way, if problems related to Docker exist in your code, you’ll find them early, rather than waiting until the code is already written and having to backtrack to fix the issues.
- You can make changes to your Docker configuration on a continuous basis. That’s better than having to change the Docker setup at irregular intervals, as a process that is distinct from the rest of your delivery pipeline.
- Your team communicates effectively. If you handle Docker as a separate task, there’s a good chance that the engineers responsible for that process won’t be able to collaborate well with the rest of your team. Without CD tools and dashboards at their disposal, they won’t be continuously aware of the state of development as a whole; instead, they’ll only be able to follow the task for which they are directly responsible.
Continuous delivery and Docker
So, how do you actually go about integrating Docker into your workflow? The most basic way is to use a Continuous Integration (CI) platform, such as Jenkins, which offers a Docker plugin. Docker CI plugins allow you to build your code inside Docker containers to create a container image, then push that image to a repository for deployment.
On their own, however, Docker plugins for CI platforms offer relatively limited functionality. They automate the process of building Docker images and pushing them to repositories, but they don’t optimize tasks like image testing and feature previews. Docker CI plugins also don’t offer support for reading container logs, or sharing container development information easily with the rest of the team.
That’s where tools like Codefresh come in. Codefresh does all of the above, out of the box. It offers a Docker-native CD platform that also supports integration with Jenkins CI if needed. It comes with container testing, logging and collaboration features built in. If you want one-stop shopping for integrating Docker into your CD workflow, Codefresh makes the process easy.