Reputation: 12690
When I run docker-compose up it logs some information to the terminal and I would like to know where this information is coming from and how I might log to it.For example I would like to output each request in a php application within the container. I have tried to look online including the docker docs but have had no luck.
Upvotes: 19
Views: 31336
Reputation: 263637
The output in docker-compose
is the stdout/stderr from the command the container runs. You see this with docker run
if you don't detach, and you can get this from docker logs
on a container you're detached from or docker-compose logs
from a compose submitted group of containers.
Edit: evidence of this behavior:
$ cat docker-compose.hello-world.yml
version: '2'
services:
hello-world:
image: busybox
command: "echo hello world"
$ docker-compose -f docker-compose.hello-world.yml up
Creating test_hello-world_1
Attaching to test_hello-world_1
hello-world_1 | hello world
test_hello-world_1 exited with code 0
Upvotes: 16