Podman : Basic Container Operations2024/02/28 |
Below are the basic container operations. |
|
[1] |
Create a FreeBSD 14 container image first, refer to [1] of here. |
[2] | Output the words [Welcome to the Podman World] inside the Container. |
root@dlp:~ # podman images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/freebsd-base latest 2527bfa5eeb4 19 hours ago 1.05 GB # run echo inside a container root@dlp:~ # podman run localhost/freebsd-base /bin/echo "Welcome to the Podman World" Welcome to the Podman World |
[3] | Connect to the interactive session of a Container with [i] and [t] option like follows. If [exit] from the Container session, the process of a Container finishes. |
root@dlp:~ #
# podman run -it localhost/freebsd-base /bin/sh # # connected
uname -ro; hostname FreeBSD 14.0-RELEASE 7989b7be4acd
#
root@dlp:~ # exit
# come back
|
[4] | If you'd like to run a container as a Daemon, add [d] option. |
root@dlp:~ # podman run -itd localhost/freebsd-base /bin/sh 57634d61baff5d7fd5f80112b0a5dd45e535d36fdb11a6ff9be83346a7768110 # show podman processes root@dlp:~ # podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 57634d61baff localhost/freebsd-base:latest /bin/sh 7 seconds ago Up 7 seconds friendly_goldstine # attach to container session root@dlp:~ # podman exec -it 57634d61baff /bin/sh # # connected # exit
# stop container process (if force stop, specify [kill]) root@dlp:~ # podman stop 57634d61baff root@dlp:~ # podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
Sponsored Link |
|