Skip to main content

Directory Structure

When choosing how to structure Docker containers, you have many options.

One of the most common methods is to have different folders for each service in a directory.

home
β”‚
└───docker
β”‚
└───nginx-proxy-manager
| β”‚ docker-compose.yml
| β”‚ .env
| |
| └───data
| |
| └───db
|
└───some-service
β”‚ docker-compose.yml
β”‚ .env
|
└───data

There is also the option to have all bind mounts in one directory, plus one large Docker Compose file or several small ones in one folder.

home
β”‚
└───docker
β”‚ docker-compose.yml
β”‚ .env
|
└───app-data
|
└───nginx-proxy-manager
| |
| └───db
| |
| └───data
|
└───some-service
|
└───data
home
β”‚
└───docker
β”‚ docker-compose-nginx-proxy-manager.yml
β”‚ .env-nginx-proxy-manager
| docker-compose-some-service.yml
| .env-some-service
|
└───app-data
|
└───nginx-proxy-manager
| |
| └───db
| |
| └───data
|
└───some-service
|
└───data

It is also possible to have the containers and the data outside the home directory.

/
β”‚
└───root
| |
| └───docker
| |
| └───containers
| | |
| | └───nginx-proxy-manager
| | | | docker-compose.yml
| | | | .env
| | |
| | └───some-service
| | | docker-compose.yml
| | | .env
| |
| └───secrets
| | nginx-proxy-manager-db-pwd
|
└───srv
|
└───nginx-proxy-manager
| |
| └───db
| |
| └───data
|
└───some-service
|
└───data

In the end, you have to decide for yourself which structure seems practical and which is less so.