My notes on how to use podman.


--- Install podman --- [root@localhost ~]# yum install podman slirp4netns --- To login to so that you can download container images --- --- if you use instead, you don't have to login --- [root@server01 ~]# podman login --- Download a container image --- [root@server01 ~]# podman pull [root@localhost ~]# podman pull [root@localhost ~]# podman pull --- Create and start a container --- [root@server01 ~]# podman run -d -P -- Start a container -- [root@server01 ~]# podman start <contain_name> --- List running containers --- [root@server01 ~]# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES fb87ff77425d /usr/bin/run-http... 4 minutes ago Up 4 minutes ago>8080/tcp,>8443/tcp hardcore_khayyam --- Start the bash shell in the given container --- [root@server01 ~]# podman exec -it fb87ff77425d bash bash-4.2$ echo "hello from my container" > /var/www/html/index.html bash-4.2$ exit --- Get the IP Address of a given container --- [root@server01 ~]# podman inspect -f "{{.NetworkSettings.IPAddress}}" fb87ff77425d --- List the ports allowed to pass through to the last used container (-l) --- --- change the -l to -a to list for all running containers --- [root@server01 ~]# podman port -l 8080/tcp -> 8443/tcp -> --- List all container images on the local system --- [root@server01 ~]# podman images REPOSITORY TAG IMAGE ID CREATED SIZE latest 0c46e5c7a82a 2 days ago 239 MB latest 7b386b0cb891 5 weeks ago 407 MB latest 291836dcc008 5 weeks ago 259 MB latest 54a9312811c3 5 weeks ago 329 MB latest 2ef6ad3f3825 5 weeks ago 215 MB --- Stop a container --- [root@server01 ~]# podman stop a2ecc1f73aff --- A sample of a more complex run command --- [root@server01 ~]# podman run --ip 10.xx.xx.xx -p 3306:3306 --name mariadb-service -v /opt/var/lib/mysql/data:/var/lib/mysql/data:Z -e MYSQL_USER=wordpress -e MYSQL_PASSWORD=mysecret -e MYSQL_DATABASE=wordpress or podman run --detach --tty --volume /tmp/html:/usr/local/apache2/htdocs -p 80:80/tcp --name apache_container --- Inspect a container image for various information --- [root@localhost ~]# podman inspect | grep User [root@localhost ~]# podman inspect | grep -A1 Volume [root@localhost ~]# podman inspect | grep -A1 ExposedPorts -- Reference URLS ---

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer