Fedora 31
Sponsored Link

Podman : Access to Services on Container2019/11/19

 
If you'd like to access to services like HTTP or SSH that is running on Containers as a daemon, 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/fedora_httpd     latest   bb6f86826d3f   About a minute ago   622 MB
docker.io/library/fedora   latest   f0858ad3febd   2 weeks ago          201 MB

# run 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

dd34fcd816106b7348a53c54ed9a84ef8f7b5e18e4995de2aee1a57e23fa35c2

[root@dlp ~]#
podman ps

CONTAINER ID  IMAGE                          COMMAND               CREATED        STATUS            PORTS                 NAMES
dd34fcd81610  srv.world/fedora_httpd:latest  /usr/sbin/httpd -...  6 seconds ago  Up 6 seconds ago  0.0.0.0:8081->80/tcp  frosty_goldwasser

# create a test page

[root@dlp ~]#
podman exec dd34fcd81610 /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.8",

[root@dlp ~]#
curl 10.88.0.8

httpd on Podman Container
Matched Content