Podman : Access to Services on Containers2022/05/24 |
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/fedora-httpd latest 6c88b642f75c About a minute ago 566 MB registry.fedoraproject.org/fedora latest 750037c05cfe 3 months ago 159 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/fedora-httpd /usr/sbin/httpd -D FOREGROUND ab4f840b199ce23740514d16af3a1227eddf66be65f17225c9f2893a5c62948c[root@dlp ~]# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ab4f840b199c srv.world/fedora-httpd:latest /usr/sbin/httpd -... 20 seconds ago Up 20 seconds ago 0.0.0.0:8081->80/tcp exciting_gates # create a test page [root@dlp ~]# podman exec ab4f840b199c /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.7", "IPAddress": "10.88.0.7",[root@dlp ~]# curl 10.88.0.7 httpd on Podman Container |
Sponsored Link |