Docker Tip #76: Where to Put Docker Compose Projects on a Server?
So, you're thinking about deploying a Docker Compose project, but where does the docker-compose.yml file go on your file system?
Let’s say you have 1 or more Docker Compose projects that you plan to run on a VPS such as DigitalOcean, but really it could be anywhere.
There’s a lot of options. Should it go in
~/ or somewhere else?
The answer is, it depends. This is really a Linux distribution specific question. For example I prefer using Ubuntu and Debian in production, and according to Debian’s Filesystem Hierarchy Standard (FHS), one reasonable place for it to go would be in the
So if you had a project called
todolist, you would end up with
/srv/todolist and inside of there you could have your
.env file and even your application’s source code depending on how you plan to deploy it.
I like this strategy because it keeps things together and well organized. I would also put non-Dockerized projects in the
/srv folder too because there’s nothing Docker specific about this decision. When in doubt, always think about what you would do without Docker first.