Podman : Access to Services on Containers2022/03/14 |
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 0c6c507d6e95 About a minute ago 253 MB quay.io/centos/centos stream9 44ffcc4acee8 3 days ago 152 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 90a7dc1a9399f29dd03e478e57988f5ce60b56648a5285a69b2a00528b095f3b[root@dlp ~]# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 90a7dc1a9399 srv.world/centos-httpd:latest /usr/sbin/httpd -... 7 seconds ago Up 8 seconds ago 0.0.0.0:8081->80/tcp nice_hertz # create a test page [root@dlp ~]# podman exec 90a7dc1a9399 /bin/bash -c 'echo "httpd on Podman Container" > /var/www/html/index.html'
# 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 |
|