Podman : Access to Services on Container2019/10/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/centos_httpd latest 67edc4066f76 37 seconds ago 368 MB docker.io/library/centos latest 0f3e07c0138f 8 days ago 227 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/centos_httpd /usr/sbin/apachectl -D FOREGROUND b471342218c016938747d1e9896027d6c341ac19c98018b06f28f8a7540b5c25[root@dlp ~]# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES b471342218c0 srv.world/centos_httpd:latest /usr/sbin/apachec... 9 seconds ago Up 9 seconds ago 0.0.0.0:8081->80/tcp frosty_williams # create a test page [root@dlp ~]# podman exec b471342218c0 /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.17",[root@dlp ~]# curl 10.88.0.17 httpd on Podman Container |
Sponsored Link |
|