Podman : Access to Services on Containers2023/03/01 |
If you'd like to access to services like HTTP or SSH that are running on Containers as daemons, Configure like follows.
|
|
[1] | For exmaple, use a Container that [httpd] is installed. |
[root@dlp ~]# podman images REPOSITORY TAG IMAGE ID CREATED SIZE srv.world/almalinux-httpd latest ffd19e5b5339 5 minutes ago 251 MB docker.io/library/almalinux latest d3ffa43c2567 6 days ago 196 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/almalinux-httpd /usr/sbin/httpd -D FOREGROUND a53d46721642a8cb56bc8fe8568bd68d21677265f250de3191adc6aba6f361c1[root@dlp ~]# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a53d46721642 srv.world/almalinux-httpd:latest /usr/sbin/httpd -... 20 seconds ago Up 21 seconds ago 0.0.0.0:8081->80/tcp hungry_chaplygin # create a test page [root@dlp ~]# podman exec a53d46721642 /bin/bash -c 'echo "httpd on Podman Container" > /var/www/html/index.html'
# verisy 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.7", "IPAddress": "10.88.0.7",[root@dlp ~]# curl 10.88.0.7 httpd on Podman Container |
Sponsored Link |
|