Podman : Access to Services on Containers2023/06/21 |
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/debian-apache2 latest f047c6f28c56 3 minutes ago 260 MB docker.io/library/debian latest 49081a1edb0b 8 days ago 121 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 srv.world/debian-apache2 /usr/sbin/apachectl -D FOREGROUND 25d79bdb048396b868a0b31a913abcbd8fe464f09f6c51a1eefb9f4f7426b6c0root@dlp:~# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 25d79bdb0483 srv.world/debian-apache2:latest /usr/sbin/apachec... 11 seconds ago Up 11 seconds ago 0.0.0.0:8081->80/tcp beautiful_buck # create a test page root@dlp:~# podman exec 25d79bdb0483 /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.7", "IPAddress": "10.88.0.7",root@dlp:~# curl 10.88.0.7 Apache2 on Podman Container |
Sponsored Link |