I use monitoring application "ManageIQ" inside Docker container with the ssl port to check the application "hawkular" which is located outside the Docker container. Below are the docker commands:
docker pull manageiq/manageiq:euwe-2
docker run --privileged -d -p 8443:443 manageiq/manageiq:euwe-2
And I configure the ssl setting inside the "ManageIQ" docker container
docker exec -ti "container-id" bash –l
[root@17a6a6bd8743 vmdb]# vi /etc/httpd/conf.d/ssl.conf
ServerName localhost:8443
SSLProtocol -All +TLSv1 +TLSv1.1 +TLSv1.2
SSLCertificateFile /opt/manageiq/manageiq-ui-service/node_modules/browser-sync/lib/server/certs/server.crt
SSLCertificateKeyFile /opt/manageiq/manageiq-ui-service/node_modules/browser-sync/lib/server/certs/server.key
[root@17a6a6bd8743 vmdb]# systemctl restart httpd
[root@17a6a6bd8743 vmdb]# yum install firewalld -y
[root@17a6a6bd8743 vmdb]# systemctl start firewalld
[root@17a6a6bd8743 vmdb]# systemctl enable firewalld
[root@17a6a6bd8743 vmdb]# firewall-cmd --add-service=https --permanent
success
[root@17a6a6bd8743 vmdb]# firewall-cmd --reload
success
The ManageIQ web application https://localhost:8443 works succesfully. But can't connect to hawkular whose URL is http://localhost:8080 located outside the Docker container.
These 2 applications have each different "localhost", however I have no idea how to handle this problem. Do I miss any process to solve this issue?
localhost
in a container
is not localhost
on host OS. these are different.
To connect the address of host OS from a container
, use docker0
interface which is default bridge network
docker serves by default.
(Of course, you could create your own docker network other than default bridge network, refer here)
$ ifconfig docker0
For example, If docker0
interface's IP is 172.20.0.1
, Use 172.20.0.1:8080
.