Skip to content

Instantly share code, notes, and snippets.

@wzulfikar
Last active October 8, 2023 12:26
  • Star 41 You must be signed in to star a gist
  • Fork 18 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
vertical format for docker ps
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
Copy link
Author

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.

@SandeepN97
Copy link

SandeepN97 commented Dec 12, 2020 via email

@wzulfikar
Copy link
Author

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.

@SandeepN97
Copy link

SandeepN97 commented Dec 12, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment