Docker logs shows logs of stopped containers

Hi everybody

I have a server with odoo containers
Active containers are db and did17
There is 2 stopped containers : didtest17 and demo17 (only visibles with “docker container ls -a”)

When I read logs “sudo docker logs --details -n 200 did17”, lines from stopped containers appear, as they’re actives :

2024-01-22 15:14:34,457 1037 INFO didtest17 odoo.modules.loading: loading 310 modules...
 2024-01-22 15:14:34,757 1037 INFO didtest17 odoo.modules.loading: 310 modules loaded in 0.30s, 0 queries (+0 extra)
 2024-01-22 15:14:34,823 16 INFO did17 werkzeug: - - [22/Jan/2024 15:14:34] "POST /web/dataset/call_kw/fleet.vehicle.state/name_create HTTP/1.0" 200 - 5 0.005 0.015
 2024-01-22 15:14:34,890 17 INFO did17 werkzeug: - - [22/Jan/2024 15:14:34] "POST /web/dataset/resequence HTTP/1.0" 200 - 11 0.014 0.025
 2024-01-22 15:14:35,649 1037 INFO didtest17 odoo.modules.loading: Modules loaded.
 2024-01-22 15:14:35,667 1037 INFO didtest17 odoo.modules.registry: Registry loaded in 1.592s
 2024-01-22 15:14:40,186 17 INFO did17 werkzeug: - - [22/Jan/2024 15:14:40] "POST /web/dataset/call_kw/res.users/get_views HTTP/1.0" 200 - 88 0.124 0.220
 2024-01-22 15:14:40,317 16 INFO did17 werkzeug: - - [22/Jan/2024 15:14:40] "POST /web/dataset/call_kw/res.users/web_read HTTP/1.0" 200 - 24 0.037 0.060
 2024-01-22 15:14:44,121 1039 INFO demo17 odoo.modules.loading: loading 1 modules...
 2024-01-22 15:14:44,160 1039 INFO demo17 odoo.modules.loading: 1 modules loaded in 0.03s, 0 queries (+0 extra)
 2024-01-22 15:14:44,199 17 INFO did17 werkzeug: - - [22/Jan/2024 15:14:44] "POST /web/dataset/call_kw/fleet.vehicle.state/get_views HTTP/1.0" 200 - 4 0.014 0.017
 2024-01-22 15:14:44,237 17 INFO did17 werkzeug: - - [22/Jan/2024 15:14:44] "POST /web/dataset/call_kw/fleet.vehicle.state/web_read HTTP/1.0" 200 - 2 0.002 0.010

I don’t understand why ? And I suppose there is an impact on performance
Do you have an idea of the cause ?


Is it really on Docker Desktop?

Since you wanted to get the logs from a specific container, logs from other containers shouldn’t appear. Are you sure those are the logs from another container and not a bug in the logs of the app in the container if that mounts the same data for example?

Also which version are you using?

Hi, and thanks for your answer.
You’re right, it’s not Docker desktop, sorry for the mistake. I use docker 25.0.0 with command lines on ubuntu 22.04, I don’t know which is correct category…
I don’t think it’s an error in app (ERP ODOO), because I update Odoo and it’s the same…
And messages from containers didtest17 and demo17 are coherents with container states (not upgrade so they try to load new modules).

Since the logs of each container are in separate json files, I can’t imagine how the logs from another container could appear. Please run the following command and check if you see logs in the json lines mentioning another container:

sudo cat $(sudo docker container inspect "$name" --format '{{ .LogPath }}') | tail -n 200

When you share the output, please, share it in a code block: How to format your forum posts

Example code block:

echo "I am a code."
echo "An athletic one, and I wanna run."

If your default logging driver is journald, then the logs are stored in the journal logs. If there is a bug in the communication between the journald and Docker, that could cause mixing logs of multiple containers in the output. You can check that by running the following command:

docker info --format '{{ .LoggingDriver }}'

but if it is journald and not “json-file”, my first command will not succeed.

Hi Ákos

Thanks for your explication, and sorry for format

I try your commands, “docker info…” answer is “json-file”
Yesterday I deleted 2 test databases and containers so “demo17/didtest17” disappear.
I keep one other container “fred17” with one database “fred”, for test.

The result of your first command is :

{"log":"2024-01-24 08:09:24,940 16 \u001b[1;32m\u001b[1;49mINFO\u001b[0m did17 werkzeug: IPADRESS - - [24/Jan/2024 08:09:24] \"POST /web/dataset/call_kw/res.users/systray_get_activities HTTP/1.0\" 200 - 5 0.010 0.037\r\n","stream":"stdout","time":"2024-01-24T08:09:24.941771556Z"}
{"log":"2024-01-24 08:09:25,037 15 \u001b[1;32m\u001b[1;49mINFO\u001b[0m did17 werkzeug: IPADRESS - - [24/Jan/2024 08:09:25] \"POST /mail/load_message_failures HTTP/1.0\" 200 - 8 0.013 0.028\r\n","stream":"stdout","time":"2024-01-24T08:09:25.038124479Z"}
{"log":"2024-01-24 08:09:25,303 15 \u001b[1;32m\u001b[1;49mINFO\u001b[0m did17 werkzeug: IPADRESS - - [24/Jan/2024 08:09:25] \"GET /web/manifest.webmanifest HTTP/1.0\" 200 - 20 0.052 0.114\r\n","stream":"stdout","time":"2024-01-24T08:09:25.303957296Z"}
{"log":"2024-01-24 08:02:42,041 20 \u001b[1;32m\u001b[1;49mINFO\u001b[0m **fred** odoo.addons.base.models.ir_cron: Starting job `SMS: SMS Queue Manager`. \r\n","stream":"stdout","time":"2024-01-24T08:02:42.042533694Z"}
{"log":"2024-01-24 08:02:42,071 20 \u001b[1;32m\u001b[1;49mINFO\u001b[0m **fred** odoo.addons.base.models.ir_cron: Job `SMS: SMS Queue Manager` done. \r\n","stream":"stdout","time":"2024-01-24T08:02:42.072651Z"}
{"log":"2024-01-24 08:02:42,087 20 \u001b[1;32m\u001b[1;49mINFO\u001b[0m **fred** odoo.addons.base.models.ir_cron: Starting job `Snailmail: process letters queue`. \r\n","stream":"stdout","time":"2024-01-24T08:02:42.08846642Z"}

I see “fred” but that’s not container name, but database name, and this database is only known from the container “fred17” ???

CONTAINER ID   IMAGE         COMMAND                  CREATED        STATUS                    PORTS                                                                                            NAMES
b3b825c43ac8   odoo17e2312   "/ --db…"   13 days ago    Exited (137) 2 days ago                                                                                                    fred17

How did you install Docker?

Sorry for long time
I delete all other containers and databases, so I don’t see them again
it seems faster, so at this time I keep this solution
Thanks a lot