Created
November 25, 2014 03:31
-
-
Save ramkumardevanathan/d25bb91d8ab170d3b656 to your computer and use it in GitHub Desktop.
simple gist to get docker ps output as csv file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker ps -a --no-trunc | awk -F " +" '{$1=$1}1' OFS="\t" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@frakman1
This is the trick
--format
with\t
ondocker container ls
and grab that onawk
with-F '\t'
Note that quoted values provided from
--format
, good to avoid undesired fields split.Of course a better way is without
awk
, in this case a simple:docker container ls --no-trunc -a --format='"{{.Names}}","{{.Image}}","{{.Ports}}","{{.Status}}"'
References:
https://docs.docker.com/engine/reference/commandline/ps/#format
https://stackoverflow.com/questions/5374239/tab-separated-values-in-awk