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

align compose ps output with docker ps #10065

Merged
merged 2 commits into from Dec 14, 2022
Merged

Conversation

ndeloof
Copy link
Contributor

@ndeloof ndeloof commented Dec 10, 2022

What I did
Align docker compose ps output with docker ps for an homogeneous user experience.
Ideally, would share code with docker/cli, maybe something to be considered for a future PR :P

example:

$ docker compose ps
NAME                IMAGE                   COMMAND                  SERVICE             CREATED              STATUS                        PORTS
sentences-db-1      gtardif/sentences-db    "docker-entrypoint.s…"   db                  About a minute ago   Up About a minute             5432/tcp
sentences-web-1     gtardif/sentences-web   "/dispatcher"            web                 About a minute ago   Up About a minute (healthy)   0.0.0.0:90->80/tcp
sentences-words-1   gtardif/sentences-api   "java -Xmx8m -Xms8m …"   words               About a minute ago   Up About a minute             0.0.0.0:95->8080/tcp
$ docker compose ps --format json |jq .
[
  {
    "ID": "e442fa59280ccd70d323c5f79fdc388622228c99abb3724e59419e9f84eb9d10",
    "Name": "sentences-web-1",
    "Image": "gtardif/sentences-web",
    "Command": "/dispatcher",
    "Project": "sentences",
    "Service": "web",
    "Created": 1670793089,
    "State": "running",
    "Status": "Up 2 minutes (healthy)",
    "Health": "healthy",
    ...

Related issue
fixes #6867

(not mandatory) A picture of a cute animal, if possible in relation to what you did
image

@ndeloof ndeloof force-pushed the align_ps_docker_cli branch 3 times, most recently from adbd655 to 1c59aa9 Compare December 11, 2022 14:04
@ndeloof ndeloof changed the title aligne compose ps output with docker ps align compose ps output with docker ps Dec 11, 2022
@ndeloof ndeloof force-pushed the align_ps_docker_cli branch 9 times, most recently from 45136ba to 2f89b88 Compare December 11, 2022 20:03
@codecov
Copy link

codecov bot commented Dec 11, 2022

Codecov Report

Base: 77.02% // Head: 76.98% // Decreases project coverage by -0.03% ⚠️

Coverage data is based on head (902b7cd) compared to base (0368f19).
Patch coverage: 76.47% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##               v2   #10065      +/-   ##
==========================================
- Coverage   77.02%   76.98%   -0.04%     
==========================================
  Files           2        2              
  Lines         235      252      +17     
==========================================
+ Hits          181      194      +13     
- Misses         48       51       +3     
- Partials        6        7       +1     
Impacted Files Coverage Δ
pkg/e2e/framework.go 75.31% <76.47%> (+0.08%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
@@ -142,21 +144,18 @@ SERVICES:

return formatter.Print(containers, opts.Format, os.Stdout,
writer(containers),
"NAME", "COMMAND", "SERVICE", "STATUS", "PORTS")
"NAME", "IMAGE", "COMMAND", "SERVICE", "CREATED", "STATUS", "PORTS")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it would be weird to show the value/path from dockerfile for services that Compose built (instead of the auto-generated image name)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure. We would get this path from the current compose file, so this would only work when ran with a --file but not with --project-name, and even with this would assume the current compose file is in sync with listed containers.

@@ -30,7 +30,7 @@ import (
// Print prints formatted lists in different formats
func Print(toJSON interface{}, format string, outWriter io.Writer, writerFn func(w io.Writer), headers ...string) error {
switch strings.ToLower(format) {
case PRETTY, "":
case TABLE, PRETTY, "":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hurray for backwards compatibility 🎉

@ndeloof ndeloof merged commit 8c39b5b into docker:v2 Dec 14, 2022
@ndeloof ndeloof deleted the align_ps_docker_cli branch December 14, 2022 21:53
LeSuisse pushed a commit to Enalean/tuleap that referenced this pull request Dec 28, 2022
The following command should not raise any error:
make psalm FILES=plugins/onlyoffice/include/DocumentServer/DocumentServerDao.php

Introduced in 9f9e629

This also fix CI tests that are failing under [docker compose 2.14.2][0].
Probably linked to the [change of docker compose ps][0]. We should
probably switch our dev environment to the same version of the CI (we
are using 2.14.0), however using directly `docker compose cp tests:…`
instead of `docker cp $(docker compose ps tests):…` seems to be good
enough.

No functional change.

[0]: https://docs.docker.com/compose/release-notes/#2142
[1]: docker/compose#10065

Part of story #29981: restrict an OnlyOffice server to some projects only

Change-Id: I31c84d55fdcfea4975ac5d592576c9846e1d0e49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docker-compose ps should show uptime
2 participants