Ubuntu 26.04

Podman : Access to Services on Containers2026/05/07

 

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 [apache2] is installed.
root@dlp:~#
podman images

REPOSITORY                TAG         IMAGE ID      CREATED        SIZE
srv.world/ubuntu-apache2  latest      53b7e6d878bc  2 minutes ago  231 MB
docker.io/library/ubuntu  latest      30ba44506a6d  2 weeks ago    111 MB

# run a container and also start [apache2]
# map with [-p xxx:xxx] to [(Host Port):(Container Port)]

root@dlp:~#
podman run -dt -p 8081:80 --security-opt apparmor=unconfined srv.world/ubuntu-apache2 /usr/sbin/apachectl -D FOREGROUND

364a185373543643899f910732d122cfea96d1f1143d8145d0785050c7e62fb7

root@dlp:~#
podman ps

CONTAINER ID  IMAGE                            COMMAND               CREATED         STATUS         PORTS                 NAMES
364a18537354  srv.world/ubuntu-apache2:latest  /usr/sbin/apachec...  11 seconds ago  Up 11 seconds  0.0.0.0:8081->80/tcp  quirky_grothendieck

# create a test page

root@dlp:~#
podman exec 364a18537354 /bin/bash -c 'echo "Apache2 on Podman Container" > /var/www/html/index.html'
# verify accesses

root@dlp:~#
curl localhost:8081

Apache2 on Podman Container
# also possible to access via container network

root@dlp:~#
podman inspect -l | grep \"IPAddress

               "IPAddress": "10.88.0.8",
                         "IPAddress": "10.88.0.8",

root@dlp:~#
curl 10.88.0.8

Apache2 on Podman Container
Matched Content