What Are the Best Practices for Setting Up Docker Containers?

0
0
Asked By TechWanderer42 On

I'm diving into Docker as I build out my homelab with containers, but before I rely on them for anything important, I want to ensure my setup has solid foundations. I've set up about 10 containers across two minimized Ubuntu Server hosts, creating individual directories for each container in /opt/docker/. I also bind-mount any required volumes to subdirectories within that path. For instance, /opt/docker/nginx-proxy-manager/ has a docker-compose.yaml file along with data/ and letsencrypt/ folders. My goal is to backup the entire /opt/docker/ directory periodically to simplify restoration on a new machine if needed. Am I doing this right, or is there a better approach? I should note that some data is on a network share mounted under /mnt, with cases like Immich where the database and media are separated. Any advice?

2 Answers

Answered By DevHackerX On

This approach is totally valid for data retention! I might suggest considering a subdirectory in /var or perhaps a different mount point just based on personal preference, but /opt works too if that’s what feels right for you!

CuriousCoder88 -

What’s the reasoning for choosing /var over /opt? I’ve seen both recommended, but opted for /opt since it seemed more POSIX compliant!

Answered By DockerNinja99 On

Sounds like you’re on the right track! I’ve done something similar and it worked flawlessly when I had to migrate hosts a couple of times. Keeping everything organized like that makes backups a breeze!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.