r/docker • u/politeauthority • Jan 19 '19
Lets make "docker ps" human readable: docker-pretty-ps
Hey guys, long time reader first time poster.
I’ve been using docker for years, but cannot stand the “docker ps” output. I use a 13” monitor primarily and have bad eyesight. Shrinking my terminals font size to 8pt so I can fit everything on one line sucks... so I made docker-pretty-ps. Instead of going wide, lets go long. I also thought you might want to search through your containers, rather that dump them all to the screen, so i added that too.
The tool uses only built in python libraries, so it should install on any platform that's running Docker + Python.
docker-pretty-ps also has a handful of other CLI utilities to help you manage that docker ps data as well. This is my first published project so let me know your thoughts/ complaints and definitely bugs!
More info over at https://github.com/politeauthority/docker-pretty-ps
Or you can just install with
pip install docker-pretty-psScreenshot Regular Usage: https://imgur.com/zgcKx3H
Screenshot of SLIM mode: https://imgur.com/AR1N0R9
Project/ Source: https://github.com/politeauthority/docker-pretty-ps
TLDR: Let's make "docker ps " readable!
Edit: grammar
Edit2: Adding screenshots of --slim (s) mode
10
u/verenion Jan 19 '19
Looks pretty cool. The only issue I would have is that we simple run lots of containers. Having each one on a single line is pretty useful, even if it’s ugly!
Should be useful for smaller host though!
15
u/politeauthority Jan 19 '19
I hear ya! With docker-pretty-ps you can do
docker-pretty-ps --slimand have all containers report on a single line. If that's not enough info for ya, you can adddocker-pretty-ps -s -i=cpThat will give you all containers, with their (c)reation date, and (p)orts. The -i flag lets you select any data point docker-ps would give you, but at your choosing. For a full list of the -i flags and everything else, checkout the github README.Thanks for the input!
5
u/moebaca Jan 19 '19
Nice work dude! It looks great. How long did it take you to develop it to this mature state?
Edit. Also a little grammatical error I noticed in the README:
always shrinking my terminal output just to see what docker ps is trying saying...
Should say something like:
always shrinking my terminal output just to see what docker ps is trying to say...
4
u/politeauthority Jan 19 '19
Thanks! Grammer/ spelling are not my strong points! I'll patch those up next chance I get.
TBH "mature" state is probably not exactly where this is, but I felt ready to share. I've been working on it on and off for a few months though probably. If you see something to fix or improve I'd love input from anyone!
5
36
u/snotsnot Jan 19 '19 edited Jan 19 '19
I pretty much switched to ctop. Looks nice though!
Edit: alias ctop='docker run --rm -ti -v /var/run/docker.sock:/var/run/docker.sock quay.io/vektorlab/ctop:latest'
3
4
4
3
1
u/SomeRedPanda Jan 19 '19
I still prefer ps. This seems like it would get really messy once you get a few more containers running. Standard way is more compact.
8
u/politeauthority Jan 19 '19
Here's a screen shot of -s or --slim.
I don't expect everyone to love it though. Thanks for the feedback!
3
u/zzopq Jan 19 '19
Agree. Appreciate author's work though.
IMO Docker team should add output like this to
docker ps. It may look likedocker ps --prettyor so7
u/politeauthority Jan 19 '19
I thought for years any day that would come... And one day I just got tired of waiting. Thus this project.
I whole heatedly agree with ya!
2
2
u/solrac214 Jan 20 '19
Similar behavior has been built into docker for a long time. It’s just not well documented. https://container42.com/2016/03/27/docker-quicktip-7-psformat/
2
1
u/khaffner91 Jan 19 '19
If you prefer pwsh/powershell: https://www.powershellgallery.com/packages/Convert-FromDocker/0.0.1/Content/Convert-FromDocker.ps1
1
u/r00t_4orce Jan 21 '19 edited Jan 21 '19
Like many others have said - It's nicer to format and get the info right from Docker.
I too am not necessarily a fan of installing something to get better output etc.
However, if you are someone interested in installing something and want great looking output - plus - additional features, take a look at:
Also has the ability to be run via container:
alias dry='docker run --rm -ti -v /var/run/docker.sock:/var/run/docker.sock moncho/dry'0
14
u/littlebluebrown Jan 19 '19
Thanks for sharing. The screenshots look nice! You think this can be done with bash and some piping?