How can I output or write output on docker?

When I start the docker assembly, it logs some information on the terminal, and I would like to know where this information comes from, and how I can register it. For example, I would like to output every request in a php application in a container. I tried looking on the Internet, including docker documents, but no luck.

+4
source share
1 answer

The output to docker-composeis stdout / stderr from the command executed by the container. You see this with help docker runif you do not disconnect, and you can get it from docker logsthe container from which you were separated, or docker-compose logsfrom an organized group containing the group.

Edit: Confirmation 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
+4
source

Source: https://habr.com/ru/post/1649566/


All Articles