Using Docker Swarm Secrets to Store and Rotate your SSL Certificates with Nginx

What is Docker Swarm Secrets?


Docker Swarm has an excellent feature out of the box — Docker Swarm secrets. Using it, you can easily keep your sensitive data like credentials, TLS certificates, etc.

In terms of Docker Swarm services, a secret is a blob of data, such as a password, SSH private key, SSL certificate, or another piece of data that should not be transmitted over a network or stored unencrypted in a Dockerfile or in your application’s source code. You can use Docker secrets to centrally manage this data and securely transmit it to only those containers that need access to it.

Docker With Spring Boot and MySQL: Docker Swarm Part 3

Docker Swarm mode

In my previous two articles, I wrote about docker basic and docker-compose where we deployed real applications to a Docker container with Docker CLI and docker-compose. In the first article, we used Dockerfile to set up our environment and deployed the application by running containers separately and then built a link between each of them.

In the second article, we ran multiple containers with the docker-compose tool. But for scaling and high-availability, we need to run our application on multiple host machines with cluster facilities. For orchestrating distributed systems at any scale to gain scalability and high availability, Docker has its own implementation called Swarm. Swarm uses the SwarmKit library for orchestration.  

”Docker Swarm or Kubernetes?”: Is It the Right Question to Ask?

First, let’s go to Google trends and see the trend for both the terms "Kubernetes" and "Docker Swarm." What do we see? Clearly, we could see that Kubernetes is beating Docker Swarm. But, is that a valid proof to say Kuberneytes is winning? No way.

Of course, the search volume and trend for "Kubernetes" might be higher, but still, this alone doesn’t prove that Docker Swarm is dead.

Monitoring Docker Swarm

In one of my last blog posts, I explained how you can set up a lightweight Docker Swarm environment. The concept, which is already an open-infrastructure project on GitHub, enables you to run your business applications and microservices in a self-hosted platform.

Today, I want to explain how you can monitor your Docker Swarm environment. Although Docker Swarm greatly simplifies the operation of business applications, monitoring is always a good idea. The following short tutorial shows how you can use Prometheus and Grafana to simplify monitoring.