Podman : Access to Services on Containers2025/01/21 |
If you'd like to access to services like HTTP or SSH that are running on Containers as daemons, Configure like follows. |
|
[1] | For example, use a Container that [httpd] is installed. |
[root@dlp ~]# podman images REPOSITORY TAG IMAGE ID CREATED SIZE srv.world/centos-httpd latest ff3843182253 About an hour ago 354 MB quay.io/centos/centos stream10 1ef274445e32 7 days ago 311 MB # run a container and also start [httpd] # map with [-p xxx:xxx] to [(Host Port):(Container Port)] [root@dlp ~]# podman run -dt -p 8081:80 srv.world/centos-httpd /usr/sbin/httpd -D FOREGROUND 93c0056177467a22ac75568cb47e41a655197ea7ea10cf4bd4f51fe57d8de262[root@dlp ~]# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 93c005617746 srv.world/centos-httpd:latest /usr/sbin/httpd -... 12 seconds ago Up 12 seconds 0.0.0.0:8081->80/tcp determined_liskov # create a test page [root@dlp ~]# podman exec 93c005617746 /bin/bash -c 'echo "httpd on Podman Container" > /var/www/html/index.html'
# line 98 : change to [no] StrictForwardPorts= no
[root@dlp ~]#
systemctl restart firewalld
# verify accesses [root@dlp ~]# curl localhost:8081 httpd on Podman Container # also possible to access via container network [root@dlp ~]# podman inspect -l | grep \"IPAddress "IPAddress": "10.88.0.10", "IPAddress": "10.88.0.10",[root@dlp ~]# curl 10.88.0.10 httpd on Podman Container |
Sponsored Link |
|