mirror of
https://github.com/Dokploy/website.git
synced 2026-06-15 20:25:25 +02:00
docs: enhance Docker Compose domain configuration guide
- Added a new section for troubleshooting in meta.json to improve user navigation. - Expanded the Docker Compose documentation to include two methods for domain configuration: using Dokploy Domains (recommended) and manual configuration with Traefik labels. - Included detailed steps and callouts for both methods, emphasizing best practices and important considerations for users. - Updated the example tutorial to clarify the manual configuration process and highlight Docker Stack requirements.
This commit is contained in:
@@ -3,24 +3,44 @@ title: Domains
|
||||
description: Configure domains for your Docker Compose application.
|
||||
---
|
||||
|
||||
When using Docker Compose, adding a domain to a service is a straightforward process. This guide will walk you through the necessary steps to configure manual domains for your application.
|
||||
import { Callout } from "fumadocs-ui/components/callout";
|
||||
|
||||
Key Steps:
|
||||
When using Docker Compose, there are **two ways** to configure domains for your services:
|
||||
|
||||
## Method 1: Using Dokploy Domains (Recommended)
|
||||
|
||||
The easiest way to configure domains is using Dokploy's native domain management feature. This method allows you to configure domains directly through the Dokploy UI without manually editing your Docker Compose file.
|
||||
|
||||
<Callout type="info">
|
||||
**Recommended**: Since v0.7.0, Dokploy supports domains natively. You can configure your domains directly in the Dokploy UI through the **Domains** tab of your Docker Compose application. This is the simplest and most user-friendly approach.
|
||||
</Callout>
|
||||
|
||||
To use this method:
|
||||
1. Navigate to your Docker Compose application in Dokploy
|
||||
2. Go to the **Domains** tab
|
||||
3. Click **Add Domain** and configure your domain
|
||||
4. Dokploy will automatically handle the routing configuration
|
||||
|
||||
For detailed instructions on using Dokploy's domain management, see the [Domains guide](/docs/core/domains).
|
||||
|
||||
## Method 2: Manual Configuration (Advanced)
|
||||
|
||||
If you prefer to configure domains manually using Traefik labels in your Docker Compose file, you can do so by following the steps below. This method gives you more control but requires manual configuration.
|
||||
|
||||
<Callout type="warn">
|
||||
Manual configuration is more complex and requires editing your Docker Compose file. We recommend using Method 1 (Dokploy Domains) unless you have specific requirements that need manual Traefik label configuration.
|
||||
</Callout>
|
||||
|
||||
### Manual Configuration Steps
|
||||
|
||||
Key Steps for manual configuration:
|
||||
|
||||
1. Add the service to the `dokploy-network`.
|
||||
2. Use Traefik labels to configure routing.
|
||||
|
||||
import { Callout } from "fumadocs-ui/components/callout";
|
||||
### Example Scenario
|
||||
|
||||
<Callout title="Attention" type="info">
|
||||
Since v0.7.0 Dokploy support domains natively. This means that you can
|
||||
configure your domain directly in the Dokploy UI, without doing the rest of
|
||||
the steps check on the [domains section](/docs/core/domains).
|
||||
</Callout>
|
||||
|
||||
Example Scenario
|
||||
|
||||
Let's consider an application with three components: a frontend, a backend, and a database. We'll start with a basic Docker Compose file and then enhance it with domain configuration.
|
||||
Let's consider an application with three components: a frontend, a backend, and a database. We'll start with a basic Docker Compose file and then enhance it with manual domain configuration.
|
||||
|
||||
```yaml
|
||||
version: "3.8"
|
||||
@@ -63,10 +83,14 @@ volumes:
|
||||
db-data:
|
||||
```
|
||||
|
||||
## Step 1: Add the Network
|
||||
### Step 1: Add the Network
|
||||
|
||||
First, we'll add the dokploy-network to our services:
|
||||
|
||||
<Callout type="info">
|
||||
**Tip**: If you prefer to isolate all services and avoid adding them to the `dokploy-network`, you can use the **Isolated Deployments** feature. This feature isolates all services and eliminates the need to manually add them to the dokploy-network. See the [Isolated Deployments guide](/docs/core/docker-compose/utilities#isolated-deployments) for more information.
|
||||
</Callout>
|
||||
|
||||
```yaml
|
||||
version: "3.8"
|
||||
|
||||
@@ -94,10 +118,14 @@ networks:
|
||||
external: true
|
||||
```
|
||||
|
||||
Step 2: Configuring Traefik Labels
|
||||
### Step 2: Configuring Traefik Labels
|
||||
|
||||
Now, let's add Traefik labels to route domains to our services. We'll focus on the frontend and backend services:
|
||||
|
||||
<Callout type="warn">
|
||||
**Important for Docker Stack**: If you're using **Docker Stack** (Docker Swarm mode), the Traefik labels must be placed in the `deploy.labels` section instead of directly in the `labels` section. See the Docker Stack example below.
|
||||
</Callout>
|
||||
|
||||
```yaml
|
||||
version: "3.8"
|
||||
|
||||
@@ -151,7 +179,7 @@ networks:
|
||||
external: true
|
||||
```
|
||||
|
||||
Understanding Traefik Labels
|
||||
### Understanding Traefik Labels
|
||||
|
||||
1. `traefik.enable=true` Enables Traefik routing for the service.
|
||||
2. `traefik.http.routers.<UNIQUE-RULE>.rule=Host('your-domain.dokploy.com')` Specifies the domain for the service
|
||||
@@ -160,14 +188,73 @@ Understanding Traefik Labels
|
||||
|
||||
**Note**: Replace `<UNIQUE-RULE>` with a unique identifier for each service (e.g., frontend-app, backend-app, etc.).
|
||||
|
||||
## Important Considerations
|
||||
#### Docker Stack Configuration
|
||||
|
||||
When using **Docker Stack** (Docker Swarm mode), labels must be placed under the `deploy.labels` section. Additionally, Docker Stack does not support the `build` directive, so you must use pre-built images from a registry:
|
||||
|
||||
<Callout type="warn">
|
||||
**Important**: Docker Stack does not support the `build` directive. You must build your images separately and push them to a Docker registry, then reference them using the `image:` directive.
|
||||
</Callout>
|
||||
|
||||
```yaml
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
frontend:
|
||||
image: your-registry.com/frontend:latest # Pre-built image from registry
|
||||
volumes:
|
||||
- ./frontend:/app
|
||||
expose:
|
||||
- 3000
|
||||
networks:
|
||||
- dokploy-network
|
||||
deploy:
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.frontend-app.rule=Host(`frontend.dokploy.com`)
|
||||
- traefik.http.routers.frontend-app.entrypoints=web
|
||||
- traefik.http.services.frontend-app.loadbalancer.server.port=3000
|
||||
|
||||
backend:
|
||||
image: your-registry.com/backend:latest # Pre-built image from registry
|
||||
volumes:
|
||||
- ./backend:/app
|
||||
expose:
|
||||
- 5000
|
||||
networks:
|
||||
- dokploy-network
|
||||
deploy:
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.backend-app.rule=Host(`backend.dokploy.com`)
|
||||
- traefik.http.routers.backend-app.entrypoints=web
|
||||
- traefik.http.services.backend-app.loadbalancer.server.port=5000
|
||||
|
||||
networks:
|
||||
dokploy-network:
|
||||
external: true
|
||||
```
|
||||
|
||||
<Callout type="info">
|
||||
The key differences for **Docker Stack** are:
|
||||
1. Labels must be nested under `deploy.labels` (not directly under `labels`)
|
||||
2. You must use `image:` with a pre-built image from a registry (Docker Stack does not support `build`)
|
||||
3. Build your images separately and push them to a registry before deploying with Docker Stack
|
||||
</Callout>
|
||||
|
||||
### Important Considerations
|
||||
|
||||
1. **Port Exposure**: Use `expose` instead of `ports` to limit port access to the container network, avoiding exposure to the host machine.
|
||||
2. **DNS Configuration**: Ensure you create `A` records pointing to your domain in your DNS Provider Settings.
|
||||
3. **HTTPS**: For HTTPS, you can use Let's Encrypt or other SSL/TLS certificates.
|
||||
4. **Isolated Deployments**: As an alternative to manually adding services to `dokploy-network`, you can use the [Isolated Deployments](/docs/core/docker-compose/utilities#isolated-deployments) feature, which automatically isolates all services and handles networking configuration for you.
|
||||
|
||||
## Deployment
|
||||
### Deployment
|
||||
|
||||
With these configurations in place, you're now ready to deploy your application using Docker Compose. This setup should be sufficient to get your services up and running with custom domain routing through Traefik.
|
||||
With these manual configurations in place, you're now ready to deploy your application using Docker Compose. This setup should be sufficient to get your services up and running with custom domain routing through Traefik.
|
||||
|
||||
<Callout type="info">
|
||||
Remember: For most use cases, we recommend using **Method 1 (Dokploy Domains)** as it's simpler and doesn't require manual Docker Compose file editing. See the [Domains guide](/docs/core/domains) for more information.
|
||||
</Callout>
|
||||
|
||||
If you have any further questions or need assistance, join our [Discord server](https://discord.com/invite/2tBnJ3jDJc) and we'll be happy to help.
|
||||
|
||||
@@ -8,6 +8,14 @@ description: "Learn how to use Docker Compose with Dokploy"
|
||||
|
||||
In this tutorial, we will create a simple application using Docker Compose and route the traffic to an accessible domain.
|
||||
|
||||
<Callout type="info">
|
||||
**Note**: There are two ways to configure domains for Docker Compose applications:
|
||||
1. **Using Dokploy Domains** (Recommended): Configure domains directly in the Dokploy UI through the **Domains** tab. See the [Domains guide](/docs/core/domains) for details.
|
||||
2. **Manual Configuration**: Configure domains using Traefik labels in your Docker Compose file (shown in this tutorial).
|
||||
|
||||
This tutorial demonstrates the manual method. For most users, we recommend using the Dokploy Domains feature as it's simpler and doesn't require editing your Docker Compose file.
|
||||
</Callout>
|
||||
|
||||
|
||||
### Steps
|
||||
|
||||
@@ -104,7 +112,8 @@ Deploy the application by clicking on "deploy" and wait for the deployment to co
|
||||
**Tips**:
|
||||
|
||||
1. Set unique names for each router: `traefik.http.routers.<unique-name>`
|
||||
2. Set unique names for each service: `traefik.http.services.<unique-name>`
|
||||
2. Set unique names for each service: `traefik.http.services.<unique-name>`
|
||||
3. Ensure the network is linked to the `dokploy-network`
|
||||
4. Set the entry point to websecure and the certificate resolver to letsencrypt to generate certificates.
|
||||
5. **For Docker Stack**: If you're using Docker Stack (Docker Swarm mode), place the labels under `deploy.labels` instead of directly under `labels`. See the [Domains guide](/docs/core/docker-compose/domains) for the Docker Stack configuration example.
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"reset-password",
|
||||
"uninstall",
|
||||
"videos",
|
||||
"troubleshooting",
|
||||
"---Cloud---",
|
||||
"cloud",
|
||||
"monitoring",
|
||||
|
||||
Reference in New Issue
Block a user