Podman : Access to Services on Container2020/05/11 |
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 a461b4b0b704 About a minute ago 452 MB registry.fedoraproject.org/fedora latest d81c91deec0d 11 days ago 208 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 e7f8ade3bb793103057ef18a295c4778f4830dd27c98e15cb3b034e8bbea4f7c[root@dlp ~]# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e7f8ade3bb79 srv.world/fedora_httpd:latest /usr/sbin/httpd -... 9 seconds ago Up 9 seconds ago 0.0.0.0:8081->80/tcp festive_mendel # create a test page [root@dlp ~]# podman exec e7f8ade3bb79 /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.7",[root@dlp ~]# curl 10.88.0.7 httpd on Podman Container |
Sponsored Link |
|