Docker Compose one-off services are not automatically attached to dokploy-network without a domain

Aperta
#6,027 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
docker, docker-compose, postgresql, typescript

Direzione di ricerca

Start from the code that builds the Dokploy Compose "Preview Compose" output and decides which services get attached to dokploy-network; the reproduction shows the attachment currently happens only when a domain is configured. Trace the Compose network settings path (the Detach dokploy-network toggle) to see why one-off services without domains are skipped. Done means the migration service appears on dokploy-network in the preview and resolves the Dokploy PostgreSQL host after redeploy. Note the reporter has not yet captured the exact DB exception, so confirm the failure mode first.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug
Problem

A Docker Compose deployment has an API service and a one-off database migration service. PostgreSQL is deployed separately using Dokploy's database feature (same project/environment). The migration service needs the PostgreSQL internal hostname, but Dokploy does not attach it to dokploy-network when the service has no domain. This breaks migration startup and blocks the API because it depends on successful migration completion.

The Compose application's Networks UI shows Detach dokploy-network disabled for both services. Nevertheless, the generated Preview Compose has no explicit dokploy-network attachment for migrate.

Adding a domain to api causes Dokploy to inject:

services:
  api:
    networks:
      - dokploy-network
      - default
networks:
  dokploy-network:
    external: true

But migrate is still only on the Compose default network. Docker inspection of the exited migration container listed only <compose-project>_default under .NetworkSettings.Networks (no dokploy-network).

Minimal reproduction
  1. Deploy PostgreSQL using Dokploy's database resource.
  2. Deploy this separate Compose application in the same Dokploy project/environment, with an internal DATABASE_URL supplied through Dokploy environment variables:
services:
  migrate:
    build:
      context: .
      target: migrate
    env_file:
      - ${ENV_FILE:-.env}
    restart: 'no'

  api:
    build:
      context: .
      target: api
    env_file:
      - ${ENV_FILE:-.env}
    depends_on:
      migrate:
        condition: service_completed_successfully
  1. Ensure the Detach dokploy-network option is off for both services in Compose network settings; save and deploy.
  2. Check Preview Compose and the migration container's network configuration.
  3. Add a Dokploy domain to api, check Preview Compose again. Only api gets dokploy-network explicitly.
Expected behavior

For Compose services where Detach dokploy-network is disabled, Dokploy should attach all relevant services (including one-off migration/worker jobs without domains) to the shared network, or provide a clear UI setting to opt in. Networking should not depend solely on configuring a domain. This should work without embedding Dokploy-specific names in an otherwise portable Compose file.

Actual behavior

The migrate service only gets the Compose default network and cannot resolve/reach the Dokploy-managed PostgreSQL service through its internal host. The migration exits with status 1; the api container remains in Created state because it depends on successful migration.

Environment
  • Self-hosted Dokploy, reported as latest (exact version not yet captured)
  • Docker Compose application and separately managed Dokploy PostgreSQL
  • Same project and environment
  • Migration service has no HTTP domain; API domain is configured later
Notes

The network inspection is consistent with the missing shared network, but the exact DB connection exception and a fresh inspection after redeploy have not yet been captured. Please advise if the Networks UI is expected to apply these attachments differently to Compose one-off services.

Related but distinct request: #4637 (project/environment network isolation).

Lingua principale
TypeScript
Stelle
38.8k
Fork
3.2k
Merge medio
1g 10h
PR unite (30g)
110

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Dokploy/dokploy

Tutte le issue di Dokploy/dokploy

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.