-
-
Save wzulfikar/f6f7dc8b9d6aa5bc207eaa31913201d8 to your computer and use it in GitHub Desktop.
export FORMAT="ID\t{{.ID}}\nNAME\t{{.Names}}\nIMAGE\t{{.Image}}\nPORTS\t{{.Ports}}\nCOMMAND\t{{.Command}}\nCREATED\t{{.CreatedAt}}\nSTATUS\t{{.Status}}\n" | |
// usage: | |
docker ps --format="$FORMAT" |
wzulfikar
commented
Nov 1, 2016
Thanks a lot. It works without the quotes as well docker ps --format=$FORMAT
Thanks! This helped me so much, because my screen it's in vertical align.
Thanks!! It's worked
I tried the same command but it doesn't work. I get error
C:\Users\DEADVILLA>export FORMAT="ID\t{{.ID}}\nNAME\t{{.Names}}\nIMAGE\t{{.Image}}\nPORTS\t{{.Ports}}\nCOMMAND\t{{.Command}}\nCREATED\t{{.CreatedAt}}\nSTATUS\t{{.Status}}\n"
'export' is not recognized as an internal or external command,
operable program or batch file.
Hey @SandeepN97, seems like you're not using shell and thus, it can't understand the export
command. I assume you were on Windows and using PowerShell to run the command. If that's true, then yes, PowerShell doesn't understand export
command. Instead, you can try run the command in git bash or wsl.
What you create inside container is not necessarily visible to your host machine unless you mount the volume from container to host.
For example, if you run your container with docker run --volume /tmp/nginx:/var/log/nginx nginx
, files that you create and put inside /var/log/nginx
in container will also be visible to /tmp/nginx
in host (and vice versa). This is because you added the --volume
option.
Check this article from DO to read more: https://www.digitalocean.com/community/tutorials/how-to-share-data-between-the-docker-container-and-the-host
If you need more, you can use "docker mount volume" as query for your Google search. Then you can dig more from there.