Example
Tutorial
In this tutorial, we will create a simple application using Docker Compose and route the traffic to an accessible domain.
Steps
- Create a new project.
- Create a new service
Compose
and select the Compose TypeDocker Compose
. - Fork this repository: Repo.
- Select Provider type: GitHub or Git.
- Select the repository:
Dokploy/docker-compose-test
. - Select the branch:
main
. - Set the Compose Path to
./docker-compose.yml
and save.
Updating Your docker-compose.yml
Add the following to your existing docker-compose.yml
file:
- Add the network
dokploy-network
to each service. - Add labels for Traefik to make the service accessible through the domain.
Example:
Let's modify the following compose file to make it work with Dokploy:
Updated version with dokploy-network and Traefik labels:
Don't set container_name property to the each service, it will cause issues with logs, metrics and other features
Make sure to point the A record to the domain you want to use for your service.
Deploy the application by clicking on "deploy" and wait for the deployment to complete. Then give Traefik about 10 seconds to generate the certificates. You can then access the application through the domain you have set.
Tips:
- Set unique names for each router:
traefik.http.routers.<unique-name>
- Set unique names for each service:
traefik.http.services.<unique-name>
- Ensure the network is linked to the
dokploy-network
- Set the entry point to websecure and the certificate resolver to letsencrypt to generate certificates.