Description
docker compose -p <project> logs -f shows only log entries of already running containers.
It does not show any entries of later started containers in the same --project-name.
Doing it without the --project-name flag with docker compose logs -f it works as expected.
It even works with the name attribute in the docker-compose.yml.
It worked with Docker Compose v1.
docker-compose.yml:
# name: test
services:
hello:
image: ubuntu
command:
[
"/bin/bash",
"-c",
"while sleep 1; do echo 'Hello'; done"
]
world:
image: ubuntu
command:
[
"/bin/bash",
"-c",
"while sleep 1; do echo 'World'; done"
]
Steps To Reproduce
- use the
docker-compose.yml
- run in a terminal
docker compose -p test up -d hello
- run in another terminal
docker compose -p test logs -f
- wait 10 seconds
- run in a terminal
docker compose -p test up -d world
- the logging terminal shows only
hello entries and no world entries
Compose Version
Docker Compose version v2.18.1
Docker Environment
Client: Docker Engine - Community
Version: 24.0.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.10.4
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.18.1
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 18
Running: 7
Paused: 0
Stopped: 11
Images: 58
Server Version: 24.0.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc io.containerd.runc.v2
Default Runtime: runc
Init Binary: docker-init
containerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8
runc version: v1.1.7-0-g860f061
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 5.19.0-42-generic
Operating System: Ubuntu 22.04.2 LTS
OSType: linux
Architecture: x86_64
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Live Restore Enabled: false
Anything else?
No response
Description
docker compose -p <project> logs -fshows only log entries of already running containers.It does not show any entries of later started containers in the same
--project-name.Doing it without the
--project-nameflag withdocker compose logs -fit works as expected.It even works with the
nameattribute in thedocker-compose.yml.It worked with Docker Compose v1.
docker-compose.yml:
Steps To Reproduce
docker-compose.ymldocker compose -p test up -d hellodocker compose -p test logs -fdocker compose -p test up -d worldhelloentries and noworldentriesCompose Version
Docker Environment
Anything else?
No response