https in multiple docker containers https in multiple docker containers apache apache

https in multiple docker containers


When linking docker containers within the same network with docker compose you need to reference them by the docker service name, thus instead of 0.0.0.0 use side-container:

ProxyPass /apptest http://side-container:8080/ProxyPassReverse /apptest https://side-container:8080/

NOTE: the server running in the side container must be listening into 0.0.0.0:8080 in its httpd configuration.

Now you can remove from the docker compose file the ports declaration altogether, because both containers are in the same docker network, therefore you don't need to expose any ports. Exposing ports are only necessary if you want to reach the side-container from localhost in the host machine or from the internet.

So from the side container remove:

ports:      - "8080:8080"

Also in the docker compose file you should replace links with the new syntax depends_on:

depends_on:      - side-container

Ports declaration

For educational purpose.

Please bear in mind that when specifying the port like 8080:8080 is the same as 0.0.0.0:8080:8080 and 0.0.0.0 listens in all requests from the internet, thus to restrict them to localhost 127.0.0.1 of the machine running docker you would do 127.0.0.1:8080:8080.