D
Dokployโ€ข11mo ago
Kirill

How to assign subdomain to docker compose application?

Im playing around with compose feature, following docs from here https://docs.dokploy.com/en/docker-compose/example For me it seems that traefic labels do nothing. I was trying to deploy https://github.com/Dokploy/docker-compose-test/blob/main/docker-compose.yml example app but it traefic service and configuration is not affected. I also see cryptic errors in docker logs for dokploy like
Error Error: child exited with code 18
at ChildProcess.<anonymous> (file:///app/dist/server.mjs:1:49388)
at ChildProcess.emit (node:events:517:28)
at maybeClose (node:internal/child_process:1098:16)
at ChildProcess._handle.onexit (node:internal/child_process:303:5)
at Process.callbackTrampoline (node:internal/async_hooks:128:17) {
code: 18,
stderr: BufferListStream {
_bufs: [
<Buffer 74 69 6d 65 3d 22 32 30 32 34 2d 30 36 2d 32 31 54 31 32 3a 33 37 3a 33 32 5a 22 20 6c 65 76 65 6c 3d 77 61 72 6e 69 6e 67 20 6d 73 67 3d 22 2f 65 74 ... 94 more bytes>,
...
Error Error: child exited with code 18
at ChildProcess.<anonymous> (file:///app/dist/server.mjs:1:49388)
at ChildProcess.emit (node:events:517:28)
at maybeClose (node:internal/child_process:1098:16)
at ChildProcess._handle.onexit (node:internal/child_process:303:5)
at Process.callbackTrampoline (node:internal/async_hooks:128:17) {
code: 18,
stderr: BufferListStream {
_bufs: [
<Buffer 74 69 6d 65 3d 22 32 30 32 34 2d 30 36 2d 32 31 54 31 32 3a 33 37 3a 33 32 5a 22 20 6c 65 76 65 6c 3d 77 61 72 6e 69 6e 67 20 6d 73 67 3d 22 2f 65 74 ... 94 more bytes>,
...
Not sure if its related... Currently Im editing traefic config files in dynamic/ myself to assign hosts, not ideal. Would be great to have a way to assign a subdomain to a port in a nice way
Example
Learn how to use Docker Compose with Dokploy
GitHub
docker-compose-test/docker-compose.yml at main ยท Dokploy/docker-com...
Contribute to Dokploy/docker-compose-test development by creating an account on GitHub.
No description
18 Replies
Kirill
KirillOPโ€ข11mo ago
No description
Siumauricio
Siumauricioโ€ข11mo ago
share your main traefik config 1. the docker compose build were succesfully? 2. the application is running and do you see any logs?
Siumauricio
Siumauricioโ€ข11mo ago
if you had dokploy installed before version v0.2.0, you have to make these changes manually to be able to use docker compose with traefik https://github.com/Dokploy/dokploy/releases/tag/v0.2.0
GitHub
Release v0.2.0 ยท Dokploy/dokploy
What's Changed ๐ŸŽŠ๐ŸŽŠ Docker compose support by @Siumauricio in #111 Add calcom, pocketbase and plausible templates to the directory Docker Compose Support We introduce docker compose support, d...
๐— ๐—ฟ๐Ÿญ๐—•๐—น๐—ฎ๐˜‡๐—ฒ
Can you share docker compose configuration
Kirill
KirillOPโ€ข11mo ago
Sorry, @๐— ๐—ฟ๐Ÿญ๐—•๐—น๐—ฎ๐˜‡๐—ฒ , do you mean docker-compose.yml file? It is this one https://github.com/Dokploy/docker-compose-test/blob/main/docker-compose.yml
GitHub
docker-compose-test/docker-compose.yml at main ยท Dokploy/docker-com...
Contribute to Dokploy/docker-compose-test development by creating an account on GitHub.
Kirill
KirillOPโ€ข11mo ago
Here is build log from
Siumauricio
Siumauricioโ€ข11mo ago
have you check this?
Kirill
KirillOPโ€ข11mo ago
No description
Kirill
KirillOPโ€ข11mo ago
No, I just reinstalled dokploy to have fresh install so its 0.2.2 version
Siumauricio
Siumauricioโ€ข11mo ago
did you modify the labels of the docker compose?
Kirill
KirillOPโ€ข11mo ago
No, used as is
Kirill
KirillOPโ€ข11mo ago
No description
Siumauricio
Siumauricioโ€ข11mo ago
Follow the example, if you had any questions let me know!: https://docs.dokploy.com/en/docker-compose/example#tutorial
Example
Learn how to use Docker Compose with Dokploy
Kirill
KirillOPโ€ข11mo ago
I think example is a bit misleading: - your-domain.com and next-app on the screenshot from cloudflare panel are different values - even if you have example in github you cant use it as is to because host is hardcoded - you actually need to fork repo, edit it, commit, and then use it in dokploy I think there is no way traefik.http.routers.<unique-name>.rule value might be configurable from ui? as its parsed before docker build
Siumauricio
Siumauricioโ€ข11mo ago
It is clear, you will not use the same domain of your-domain.com and use next-app as an example that I put in the cloudflare, and it is clear that you can not use the same example that's why it mentions that you make a fork, and there is a section that mentions you need to modify the existing docker compose file, We could do something similar, however we prefer to keep the docker compose standard and not alter its behavior internally, so you have full control of your file.
Kirill
KirillOPโ€ข11mo ago
Finally I managed to make this labels for trafic actualy work. For this I had to reinstall docker as previous installation of dokploy somehow affected Here, I created simplier compose example that you may use in docs
version: "3"

services:
todo-list:
image: thoba/todo-list-app
restart: always
ports:
- 8080
networks:
- dokploy-network
labels:
- "traefik.enable=true"
- "traefik.http.routers.todo-list-example.rule=Host(`YOUR_DOMAIN`)"
- "traefik.http.routers.todo-list-example.entrypoints=websecure"
- "traefik.http.routers.todo-list-example.tls.certResolver=letsencrypt"
- "traefik.http.services.todo-list-example.loadbalancer.server.port=8080"
networks:
dokploy-network:
external: true
version: "3"

services:
todo-list:
image: thoba/todo-list-app
restart: always
ports:
- 8080
networks:
- dokploy-network
labels:
- "traefik.enable=true"
- "traefik.http.routers.todo-list-example.rule=Host(`YOUR_DOMAIN`)"
- "traefik.http.routers.todo-list-example.entrypoints=websecure"
- "traefik.http.routers.todo-list-example.tls.certResolver=letsencrypt"
- "traefik.http.services.todo-list-example.loadbalancer.server.port=8080"
networks:
dokploy-network:
external: true
Managed to make it work on my machine https://todo.dokploy.kcrz.dev/ Guess, this question is no longer relevant, as this issue was caused (most likely) by my previous dokploy install. So if something works buggy โ€” reinstall docker
Siumauricio
Siumauricioโ€ข11mo ago
congrats, I don't know if you read the release notes
Kirill
KirillOPโ€ข11mo ago
no

Did you find this page helpful?