Skip to content

Directory Structure

Understanding how to organize your Docker containers and related files is crucial for maintaining a scalable and manageable infrastructure.

Service-Based Organization

The most straightforward approach is to organize containers by service, with each service having its dedicated directory. This structure provides clear separation and makes individual service management easier.

  • Directoryhome
    • docker
    • Directorynginx-proxy-manager
      • docker-compose.yml
      • .env
      • Directorydata/
      • Directorydb/
    • Directorysome-service
      • docker-compose.yml
      • .env
      • Directorydata/

Centralized Organization

For easier backup and maintenance, you can centralize all configurations and data in a single location:

  • Directoryhome
    • Directorydocker
      • docker-compose.yml
      • .env
      • Directoryapp-data
        • Directorynginx-proxy-managher
          • Directorydata/
          • Directorydb/
        • Directorysome-service
          • Directorydata/

Split Configuration Files

For complex setups, maintaining separate compose files while centralizing data can provide better organization:

  • Directoryhome
    • Directorydocker
      • docker-compose-nginx-proxy-manager.yml
      • .env-nginx-proxy-manager
      • docker-compose-some-service.yml
      • .env-some-service
      • Directoryapp-data
        • Directorynginx-proxy-managher
          • Directorydata/
          • Directorydb/
        • Directorysome-service
          • Directorydata/

System-Wide Installation

For production environments, consider separating configurations and data across system directories for enhanced security and organization:

  • Directory/
    • Directoryroot
      • Directorydocker
        • Directorycontaienrs
          • Directorynginx-proxy-manager
            • docker-compose.yml
            • .env
          • Directorysome-service
            • docker-compose.yml
            • .env
        • Directorysecrets
          • nginx-proxy-manager-db-pwd
    • Directorysrv
      • Directorynginx-proxy-manager
        • Directorydata/
        • Directorydb/
      • Directorysome-service
        • Directorydata/

Remember that there’s no one-size-fits-all solution - choose the structure that best aligns with your specific needs and operational requirements.