Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip project prefix from docker-compose up output in non-compatibility mode #11188

Closed
gyorokpeter opened this issue Nov 14, 2023 · 2 comments · Fixed by #11190
Closed

Strip project prefix from docker-compose up output in non-compatibility mode #11188

gyorokpeter opened this issue Nov 14, 2023 · 2 comments · Fixed by #11190

Comments

@gyorokpeter
Copy link

Description

Without compatibility mode, the prefix looks like project-container-1. With compatibility mode (export COMPOSE_COMPATIBILITY=true), it's container_1, lacking the prefix. In my case the project name has to be very long, and printing it on every line makes it hard to read and increases the size of the log file by a significant amount. Considering that compatibility mode should only be a temporary measure, I would like to be able to strip the project prefix from the log lines so the prefix is just container-1 without the project name even when not using compatibility mode. The closest option seems to be --no-log-prefix but that strips the entire prefix, not just the project name, making it hard to tell which container is outputting which line.

@ndeloof
Copy link
Contributor

ndeloof commented Nov 15, 2023

Which version are you using ?
Can't reproduce with latest release:

$ cat compose.yaml 
services:
  test:
    image: alpine
    command: ping localhost
$  docker compose up
[+] Running 1/0
 ✔ Container bidule_test_1  Created                                        0.0s 
Attaching to test_1
test_1  | PING localhost (127.0.0.1): 56 data bytes
test_1  | 64 bytes from 127.0.0.1: seq=0 ttl=64 time=0.058 ms
test_1  | 64 bytes from 127.0.0.1: seq=1 ttl=64 time=0.205 ms

@gyorokpeter
Copy link
Author

gyorokpeter commented Nov 15, 2023

$ docker compose version
Docker Compose version v2.17.3
$ docker compose -p bidule up
[+] Running 2/2
 ✔ Network bidule_default   Created                                                                              0.0s
 ✔ Container bidule-test-1  Created                                                                              0.1s
Attaching to bidule-test-1
bidule-test-1  | PING localhost (127.0.0.1): 56 data bytes
bidule-test-1  | 64 bytes from 127.0.0.1: seq=0 ttl=64 time=0.675 ms
bidule-test-1  | 64 bytes from 127.0.0.1: seq=1 ttl=64 time=0.089 ms
^CGracefully stopping... (press Ctrl+C again to force)

The ask is to be able to specify that I want the prefix to be test-1 instead of bidule-test-1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants