DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Using Azure DevOps Pipeline With Gopaddle for No-Code Kubernetes Deployments
  • CI/CD With Azure DevOps and Alibaba Cloud Kubernetes (ACK)
  • Look, Ma! No Pods!
  • Release Pipeline Using Azure DevOps

Trending

  • Apple and Anthropic Partner on AI-Powered Vibe-Coding Tool – Public Release TBD
  • The End of “Good Enough Agile”
  • Agile’s Quarter-Century Crisis
  • Creating a Web Project: Caching for Performance Optimization
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Docker Compose CI/CD in Azure DevOps

Docker Compose CI/CD in Azure DevOps

A tutorial for deploying Docker images and using Docker Compose in Azure CI/CD pip

By 
Vasyl Kutsyk user avatar
Vasyl Kutsyk
·
Sep. 25, 19 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
33.2K Views

Join the DZone community and get the full member experience.

Join For Free

juggling

Juggling multiple things at once

For one of our clients who is a very big player in medical device development, we had to develop a solution which will be easily deployable in the cloud or on-premise infrastructure. So, as you might suspect, we knew that we will work with containers.

There was no discussion of containerization technology, so Docker first and Docker Compose second.

The next point was to define whether we will have clusterization to define if we need features of Swarm or even Kubernetes. Through small talks with the business department, we knew that using orchestration wouldn't give any profit and all deployment will be on one machine via SSH.

So what we had were:

  • for each service (front-end, back-end, and database)
  • Docker Compose (to run from one command)
  • SSH machine access
  • Azure DevOps for CI/CD

As one of the points is that we will deploy on-premise infrastructure, we generalized that to run the solution on the client-side, we will need only SSH access with root rights on the machine. And what we have to do is to implement continuous deployment for this in Azure DevOps.

As in any normal process of deployment, we will have two steps, build and release.

Build

You can easily find in the documentation for how to build and push a Docker image in Azure DevOps here.

As soon as you have your image pushed into your container registry you can proceed to release.

An important point for our build is to remember that to proceed with our release, we have to copy the docker-compose file to our server, so we can initialize proper services with images.

So at the end of the build, we should put our docker-compose file into the artifact.

copy docker-compose to artifact

Copy docker-compose to artifact

Before creating a release, we need access to the machine on which we are going to deploy our solution.

Configuring Environment

My container registry is Azure Container Registry and one virtual machine with Ubuntu 18.04.

Steps to do:

  • Connect to machine using SSH
  • Install Docker
  • Test docker
  • Install docker-compose
  • Test docker-compose

Release

If you already connected to your machine and have installed all the tools that you need, you can proceed in creating your Release. To run docker-compose on any remote machine we need to have docker-compose installed, be logged in to container registry, clean old images, and execute the command.

Our release links to our artifact, which contains docker-compose.yml and two tasks.

Release flow

Release flow

Setting up tasks is next:

1. Securely copy files to the remote machine.

Copying to remote machine

Copying to the remote machine

2. Run shell inline on the remote machine

run shell commands

Run shell commands

Here is a full script:

docker login -u $(docker.username) -p $(docker.password) $(docker.registry) 
cd deploy 
docker-compose pull 
docker-compose stop
docker-compose rm -f
docker-compose up -d


 $(docker.username) -p $(docker.password) $(docker.registry) are Variables in release definition, which gives us the possibility to hide them in logs.

That’s all folks!

Our continuous deployment for docker-compose is done. Now as soon as you want to deploy a new version of your Docker image to your VM, you press two buttons — Queue Build and Create Release.

Thanks for reading!

If you have other errors during deployment or you interested in another topic, please add comments and upvote. We‘re interested in the dialog.

Further Reading

Set Up and Deploy to Kubernetes Using Azure DevOps (CI/CD)

Continuous Integration/Deployment Docker (software) azure DevOps Kubernetes Machine Release (computing)

Published at DZone with permission of Vasyl Kutsyk. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Using Azure DevOps Pipeline With Gopaddle for No-Code Kubernetes Deployments
  • CI/CD With Azure DevOps and Alibaba Cloud Kubernetes (ACK)
  • Look, Ma! No Pods!
  • Release Pipeline Using Azure DevOps

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!