Skip to main content

Project configuration

Templates

Docker Commands provides a set of templates to start your project. You can use one of them or create your own.

Project structure

Default project structure

project_root
├── .docker
│ ├── .env
│ ├── commands
│ │ ├── my_custom_command
│ ├── docker-compose.yml
│ ├── etc
│ │ └── service_name
│ │ └── service_config.conf
│ └── services
│ └── service_name
│ └── Dockerfile
├── dcmd.toml # optional in that case
└── # ...every files related to your project, framework, etc

You can change the default project structure by creating a dcmd.toml file at project root and set the right paths.

See CLI Configuration section.

Project name

In the docker-compose.yml file you must set the name of the project on the top (can't be loaded from env variables). my_awesome_project for example:

.docker/docker-compose.yml
version: '3.9'

name: my_awesome_project

services:
# services below...

Docker environment variables

Copy .docker/.env.example to .docker/.env, then set the right variables values for your project :

NameDescriptionExample
SUBNET_BASEEach project should have its own subnet base192.168.[1-254] or 172.17.[1-254]
PROJECT_ROOTWhere your project is located/Users/me/Projects/my_awesome_project
PROJECT_NAMEThe name of your projectmy_awesome_project

These variables are used by the docker-compose.yml file to create the right network and volumes and they are mandatory. You can add as many variables as you want, they will be loaded by the docker-compose.yml file and be available in your command's files.