Last active
March 14, 2024 13:36
-
-
Save wzulfikar/f6f7dc8b9d6aa5bc207eaa31913201d8 to your computer and use it in GitHub Desktop.
vertical format for docker ps
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
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" |
SandeepN97
commented
Dec 12, 2020
via email
Thank you for the help, now I can see that it works through git bash.
can you also help me to figure out why don't I see the file about.html
which I created in the container be seen in my host file
root@b676b6857a8f:/usr/share/nginx/html# ls -al
total 20
drwxr-xr-x 1 root root 4096 Dec 12 17:43 .
drwxr-xr-x 1 root root 4096 Dec 11 06:52 ..
-rw-r--r-- 1 root root 494 Nov 24 13:02 50x.html
-rw-r--r-- 1 root root 0 Dec 12 17:43 about.html
-rw-r--r-- 1 root root 612 Nov 24 13:02 index.html
root@b676b6857a8f:/usr/share/nginx/html#
I can see the file in container but not in my folder that is in host
…On Sat, Dec 12, 2020 at 11:09 AM Wildan Zulfikar ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
Hey @SandeepN97 <https://github.com/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.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://gist.github.com/f6f7dc8b9d6aa5bc207eaa31913201d8#gistcomment-3559325>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APV6VWMBMM4J5B62VGBIBKTSUOPTNANCNFSM4J64CBZQ>
.
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.
Thanks again
I have mounted the volume from the container
docker run --name website -v $(pwd):usr/share/nginx/html -d -p 8080:80
nginx:latest
and then docker exec -it website bash to execute the container in
interactive mode
dont this help share file between container and host
…On Sat, Dec 12, 2020 at 11:59 AM Wildan Zulfikar ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
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.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://gist.github.com/f6f7dc8b9d6aa5bc207eaa31913201d8#gistcomment-3559360>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APV6VWPAXTKSAP6QIRJWW2DSUOVOLANCNFSM4J64CBZQ>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment