Podman: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
"Podman is a daemonless container engine for developing, managing, and running OCI Containers on your Linux System." (Cited from [https://podman.io/ Podman])
"Podman is a daemonless container engine for developing, managing, and running OCI Containers on your Linux System." (Cited from [https://podman.io/ Podman])
== Quick links ==
* [https://podman-desktop.io/ Leverage Podman with a Desktop App | Podman Desktop] for {{Win}}, {{Mac}} & {{Linux}}
== Build an image from a Dockerfile ==
* {{ kbd | key=<nowiki>docker build [OPTIONS] PATH | URL | -</nowiki>}} <ref>[https://docs.docker.com/engine/reference/commandline/build/ docker build | Docker Documentation]</ref>
* {{ kbd | key=podman build [options] [context]}} e.g. {{ kbd | key=podman build -f ./Dockerfile}} <ref>[https://docs.podman.io/en/latest/markdown/podman-build.1.html podman-build — Podman documentation]</ref>


== Display the log of the container ==
== Display the log of the container ==
* {{ kbd | key=<nowiki>docker logs [OPTIONS] CONTAINER</nowiki>}} <ref>[https://docs.docker.com/engine/reference/commandline/logs/ docker logs | Docker Documentation]</ref>
* {{ kbd | key=<nowiki>docker logs [OPTIONS] CONTAINER</nowiki>}} <ref>[https://docs.docker.com/engine/reference/commandline/logs/ docker logs | Docker Documentation]</ref>
* {{ kbd | key=<nowiki>podman logs [options] container [container…]</nowiki>}} e.g {{ kbd | key=<nowiki>podman logs <ID_OR_NAME></nowiki>}} <ref>[https://docs.podman.io/en/latest/markdown/podman-logs.1.html podman-logs — Podman documentation]</ref>
* {{ kbd | key=<nowiki>podman logs [options] container [container…]</nowiki>}} e.g {{ kbd | key=<nowiki>podman logs <CONTAINER_ID_OR_NAME></nowiki>}} <ref>[https://docs.podman.io/en/latest/markdown/podman-logs.1.html podman-logs — Podman documentation]</ref>
** If the content of log is too long, enter the command to brief the content {{ kbd | key=<nowiki>podman logs --tail=10 <CONTAINER_ID_OR_NAME></nowiki>}} to output the {{ kbd | key=10}} ({{ kbd | key=<nowiki>--tail=<LINE></nowiki>}}) of LINES at the end of the logs.


== List images ==
== List the images ==
* {{ kbd | key=<nowiki>docker image ls [OPTIONS] [REPOSITORY[:TAG]]</nowiki>}} <ref>[https://docs.docker.com/engine/reference/commandline/image_ls/ docker image ls | Docker Documentation]</ref>
* {{ kbd | key=<nowiki>docker image ls [OPTIONS] [REPOSITORY[:TAG]]</nowiki>}} <ref>[https://docs.docker.com/engine/reference/commandline/image_ls/ docker image ls | Docker Documentation]</ref>
* {{ kbd | key=podman images [options] [image]}} <ref>[https://docs.podman.io/en/latest/markdown/podman-images.1.html podman-images — Podman documentation]</ref>
* {{ kbd | key=podman images [options] [image]}} <ref>[https://docs.podman.io/en/latest/markdown/podman-images.1.html podman-images — Podman documentation]</ref>


== List containers ==
== List the containers ==
List running containers
List running containers
* {{ kbd | key=<nowiki>docker container ls [OPTIONS]</nowiki>}} <ref>[https://docs.docker.com/engine/reference/commandline/container_ls/ docker container ls | Docker Documentation]</ref>
* {{ kbd | key=<nowiki>docker container ls [OPTIONS]</nowiki>}} <ref>[https://docs.docker.com/engine/reference/commandline/container_ls/ docker container ls | Docker Documentation]</ref>
Line 18: Line 26:
* {{ kbd | key=podman ps -a}}
* {{ kbd | key=podman ps -a}}


== Build an image from a Dockerfile ==
== Remove the container ==
* {{ kbd | key=<nowiki>docker build [OPTIONS] PATH | URL | -</nowiki>}} <ref>[https://docs.docker.com/engine/reference/commandline/build/ docker build | Docker Documentation]</ref>
* {{ kbd | key=<nowiki>docker rm [OPTIONS] CONTAINER [CONTAINER...]</nowiki>}} e.g. {{ kbd | key=<nowiki>docker container rm <CONTAINER_ID></nowiki>}} <ref>[https://docs.docker.com/engine/reference/commandline/rm/ docker rm | Docker Documentation]</ref>
* {{ kbd | key=podman build [options] [context]}} e.g. {{ kbd | key=podman build -f ./Dockerfile}} <ref>[https://docs.podman.io/en/latest/markdown/podman-build.1.html podman-build — Podman documentation]</ref>
* {{ kbd | key=<nowiki>podman rm [options] container</nowiki>}} e.g. {{ kbd | key=<nowiki>podman rm <CONTAINER_ID></nowiki>}} <ref>[https://docs.podman.io/en/latest/markdown/podman-rm.1.html podman-rm — Podman documentation]</ref>
 
== Start the container from image ==
* {{ kbd | key=<nowiki>docker run [OPTIONS] IMAGE [COMMAND] [ARG...]</nowiki>}} <ref>[https://docs.docker.com/engine/reference/commandline/run/ docker run | Docker Documentation]</ref>
* {{ kbd | key=<nowiki>podman run [options] image [command [arg …]]</nowiki>}} e.g. {{ kbd | key=<nowiki>podman run --name <CONTAINER_NAME> <IMAGE_ID></nowiki>}} <ref>[https://docs.podman.io/en/latest/markdown/podman-run.1.html podman-run — Podman documentation]</ref>




Line 26: Line 38:
<references />
<references />


[[Category:Web Dev]]
[[Category: Web Dev]]
[[Category: Docker]]

Latest revision as of 11:13, 22 January 2025

"Podman is a daemonless container engine for developing, managing, and running OCI Containers on your Linux System." (Cited from Podman)

Quick links[edit]

Build an image from a Dockerfile[edit]

  • docker build [OPTIONS] PATH | URL | - [1]
  • podman build [options] [context] e.g. podman build -f ./Dockerfile [2]

Display the log of the container[edit]

  • docker logs [OPTIONS] CONTAINER [3]
  • podman logs [options] container [container…] e.g podman logs <CONTAINER_ID_OR_NAME> [4]
    •  If the content of log is too long, enter the command to brief the content podman logs --tail=10 <CONTAINER_ID_OR_NAME> to output the 10 (--tail=<LINE>) of LINES at the end of the logs.

List the images[edit]

  • docker image ls [OPTIONS] [REPOSITORY[:TAG]] [5]
  • podman images [options] [image] [6]

List the containers[edit]

List running containers

  • docker container ls [OPTIONS] [7]
  • podman ps [8]

List all containers

  • docker container ls -a
  • podman ps -a

Remove the container[edit]

  • docker rm [OPTIONS] CONTAINER [CONTAINER...] e.g. docker container rm <CONTAINER_ID> [9]
  • podman rm [options] container e.g. podman rm <CONTAINER_ID> [10]

Start the container from image[edit]

  • docker run [OPTIONS] IMAGE [COMMAND] [ARG...] [11]
  • podman run [options] image [command [arg …]] e.g. podman run --name <CONTAINER_NAME> <IMAGE_ID> [12]


References[edit]