Hey everyone! I'm currently working for a company that uses Docker in swarm mode to run a large WordPress site. I'm in the process of developing an automated backup and rollout system for the volumes, but I've run into a problem: swarm mode generates containers with random names which complicates things. I'm considering switching to standalone mode instead. My main question is whether it's possible to do this while Docker is running, and if there will be any issues with our current containers. We're hosting everything on a GCP server. Thanks for your help!
4 Answers
You don't actually need to disable swarm mode to run a container as a standalone service. You can just remove the swarm service and recreate your container with your desired options. However, be aware that swarm-related features like secrets and configs will no longer work after that change.
I tried switching from swarm back to standalone mode in a dev environment, but I faced issues with MariaDB losing permissions and root access. After going back and forth, I found that the UID/GID reset on MariaDB caused all permissions to be lost. I even tried to define the user as 999:999 while creating the MariaDB container, but I still ran into the same problems.
Instead of turning off swarm mode, consider scaling your services down to 0 if you need to back them up. After the backup is done, you can scale them back up. Remember, the volume and service names should stay fixed. Just make sure to use the appropriate swarm commands when doing this.
We actually run swarm on bare metal, and the container names are pretty consistent here. They follow a pattern like service_name.1, service_name.2, and so on. It might be worth checking how your services are defined since that could help in your backup process.
I'm actually looking to completely disable swarm mode without stopping or breaking any existing containers. I haven't done this before, so I'm unsure what to expect. We aren't utilizing any swarm-specific features.