I can elaborate on containers that are no specified with a profile.
I think they should just be grouped into a general block ‘[ CONTAINERS ]’ or similar. The ideal default behaviour would be that containers with profiles are grouped and displayed together (or for solo containers, just on their own but in their own section as shown in the mock up image above).
There is no label automatically added by compose.
docker inspect postgres:
"Labels": {
"com.docker.compose.config-hash": "63b87db6aa9c04f539b7e35f20f3c1eedba57f39d1ba61e0f9c9b6c4a39c749d",
"com.docker.compose.container-number": "1",
"com.docker.compose.oneoff": "False",
"com.docker.compose.project": "docker",
"com.docker.compose.project.config_files": "docker-compose.yml",
"com.docker.compose.project.working_dir": "/home/tom/docker",
"com.docker.compose.service": "postgres",
"com.docker.compose.version": "1.28.5"
},
It can be added easily manually to the compose file:
labels:
- profile=apps
docker inspect postgres:
"Labels": {
"com.docker.compose.config-hash": "ed10cf093940fdb2ae82d12f45a1635f5141ca6beb21f4006208b6552ea6b9bf",
"com.docker.compose.container-number": "1",
"com.docker.compose.oneoff": "False",
"com.docker.compose.project": "docker",
"com.docker.compose.project.config_files": "docker-compose.yml",
"com.docker.compose.project.working_dir": "/home/tom/docker",
"com.docker.compose.service": "postgres",
"com.docker.compose.version": "1.28.5",
"profile": "apps"
},
Ideally though, it would be automatically added to allow for searching based on profile without creating unnecessary bloat in docker-compose.yml files.
Adding the label also does not enable the --filter command to work unfortunately.
docker ps --filter label=profile=${apps}
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES