-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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 docker compose ps
with docker ps
#10918
Conversation
046323d
to
c937ba3
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #10918 +/- ##
==========================================
+ Coverage 58.14% 58.20% +0.06%
==========================================
Files 121 122 +1
Lines 10693 10776 +83
==========================================
+ Hits 6217 6272 +55
- Misses 3862 3887 +25
- Partials 614 617 +3
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I only ran into one issue, which is there's no truncation on COMMAND
.
Current:
❯ docker compose ps -a
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
pstest-fib-1 debian "bash -c 'function f…" fib 3 seconds ago Up 3 seconds 0.0.0.0:57185->34123/tcp
pstest-sleep-1 debian "sleep infinity" sleep 2 minutes ago Up 2 minutes
This PR:
❯ ~/dev/compose/bin/build/docker-compose ps -a
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
pstest-fib-1 debian bash -c 'function fib(){
if [ $1 -le 0 ]; then
echo 0
elif [ $1 -eq 1 ]; then
echo 1
else
echo $[`fib $[$1-2]` + `fib $[$1 - 1]` ]
fi
}
fib $THIS_IS_THE_FIBONACCI_NUMBER
' fib 13 seconds ago Up 12 seconds 0.0.0.0:57185->34123/tcp
pstest-sleep-1 debian sleep infinity sleep 3 minutes ago Up 3 minutes
(yes I copy pasted a shell script to calculate the fibonacci sequence as an inline command
in Compose YAML)
docker ps
:
❯ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0657d4b4fcd6 debian "bash -c 'function f…" 37 seconds ago Up 36 seconds 0.0.0.0:57185->34123/tcp pstest-fib-1
1b9380a354f1 debian "sleep infinity" 3 minutes ago Up 3 minutes pstest-sleep-1
name: pstest
services:
fib:
image: debian
init: true
ports:
- 34123
command:
- bash
- -c
- |
function fib(){
if [ $$1 -le 0 ]; then
echo 0
elif [ $$1 -eq 1 ]; then
echo 1
else
echo $$[`fib $$[$$1-2]` + `fib $$[$$1 - 1]` ]
fi
}
fib $$THIS_IS_THE_FIBONACCI_NUMBER
environment:
- THIS_IS_THE_FIBONACCI_NUMBER=${THIS_IS_THE_FIBONACCI_NUMBER:-100}
sleep:
image: debian
init: true
command: [sleep, infinity]
@milas indeed, missed a copy/paste from docker/cli :P |
fa7d606
to
c26ea3f
Compare
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Does Docker compose follow semver? This is clearly a breaking change, and it actually broke stuff that expects a certain behavior. |
nope, at least not in the sense "no single backward incompatible change will happen without a major version bump" |
Dear Developers, Sincere... heartfelt... gratitude for the ineffably marvelous project and the work, contribution you do (really)... I am sorry, but I just... I just... have to express it... My dear... It's been days I've trying to figure out what was causing Apparently, THIS did. ALL the tests on production, staging, and test environments were checking whether Docker Compose returns a valid 64 LENGTH string, and the command itself was: docker compose ps --format 'json' -- php; Sure thing it returned 64 characters and there were tests Now, apparently, it is: docker compose ps --no-trunc --format=json -- php; I mean... JSON is non-human format frankly... even if it is fairly readable! It was specifically created to transfer/store machine data, wasn't it?! Why would you want to send short format of such important data like
Uhh... JSON Statham... 🕊️ Best and kind regards ✨ |
😅
indeed. |
Related to the above; |
What I did
Use the docker/cli formatter to implement
docker compose ps
so that--format
offers the same templating optionsNote: this is a breaking change as
--format "json"
used to produce a json array, while docker/cli produces Newline-separated json stream.Related issue
closes #10874
https://docker.atlassian.net/browse/ENV-282
(not mandatory) A picture of a cute animal, if possible in relation to what you did