Skip to content

docker compose logs requires explicit project name in order to work #1498

@dossy

Description

@dossy

Description

docker compose logs seems to not calculate the default project name from the current working directory as it normally does for other docker compose commands.

$ basename $(pwd)
dbmate

$ docker compose ps
NAME                    IMAGE                          COMMAND                  SERVICE        CREATED         STATUS                   PORTS
dbmate-supavisor-db-1   supabase/postgres:15.1.0.148   "docker-entrypoint.s…"   supavisor-db   3 minutes ago   Up 3 minutes (healthy)   5432/tcp

$ docker compose logs

# no output - this should work and display logs from the running dbmate-supavisor-db-1 container

$ docker logs dbmate-supavisor-db-1 2>&1 | tail -2
 2026-02-08 23:03:16.137 UTC [168] LOG:  TimescaleDB background worker launcher connected to shared catalogs
 2026-02-08 23:03:16.140 UTC [170] LOG:  pg_cron scheduler started

# docker logs command can get logs just fine

$ docker compose -p $(basename $(pwd)) logs 2>&1 | tail -2
supavisor-db-1  |  2026-02-08 23:08:16.166 UTC [163] LOG:  checkpoint starting: time
supavisor-db-1  |  2026-02-08 23:08:22.707 UTC [163] LOG:  checkpoint complete: wrote 68 buffers (0.4%); 0 WAL file(s) added, 0 removed, 0 recycled; write=6.529 s, sync=0.006 s, total=6.542 s; sync files=22, longest=0.004 s, average=0.001 s; distance=383 kB, estimate=383 kB

# and, docker compose logs command can get logs if we explicitly tell it the
# project name with -p, which we shouldn't have to do if the project name
# is the default value which should be the name of the directory the Compose
# file is in.

Version

$ colima version && limactl --version && qemu-img --version
colima version 0.9.1
git commit: 0cbf719f5409ce04b9f0607b681c005d2ff7d94a

runtime: docker
arch: x86_64
client: v29.1.3
server: v28.4.0
limactl version 2.0.3
bash: qemu-img: command not found

Operating System

  • macOS Intel <= 13 (Ventura)
  • macOS Intel >= 14 (Sonoma)
  • Apple Silicon <= 13 (Ventura)
  • Apple Silicon >= 14 (Sonoma)
  • Linux

Output of colima status

$ colima status
INFO[0001] colima is running using macOS Virtualization.Framework 
INFO[0001] arch: x86_64                                 
INFO[0001] runtime: docker                              
INFO[0001] mountType: virtiofs                          
INFO[0001] docker socket: unix:///Users/dossy/.colima/default/docker.sock 
INFO[0001] containerd socket: unix:///Users/dossy/.colima/default/containerd.sock 

Reproduction Steps

  1. docker compose up -d
  2. docker compose logs
  3. docker compose -p $(basename $(pwd)) logs

Expected behaviour

Logs should be displayed.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions