Podman : Access to Services on Containers2022/04/28 |
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 c5d3a78bc38f About a minute ago 224 MB docker.io/library/ubuntu latest 3f4714ee068a 6 days ago 80.3 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/ubuntu-apache2 /usr/sbin/apachectl -D FOREGROUND ef25ce9d1663e0419f9f12efe8cdb8099277e4654e8d463d1739125c1e1be792root@dlp:~# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ef25ce9d1663 srv.world/ubuntu-apache2:latest /usr/sbin/apachec... 8 seconds ago Up 8 seconds ago 0.0.0.0:8081->80/tcp brave_sutherland # create a test page root@dlp:~# podman exec ef25ce9d1663 /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 |
|