I'm trying to deploy an web app in a VM instance at Google Compute Engine (GCP). I connect to instance via ssh and deployed docker-compose orchestrated app. Which runs two docker containers as below.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
6824c19fad9b wordpress:latest "docker-entrypoint.s…" 3 hours ago Up 22 seconds 0.0.0.0:8065->80/tcp
3079c9872e3d mysql:5.7 "docker-entrypoint.s…" 3 hours ago Up 3 hours 3306/tcp
As per my previous experiences I mapped host instance's port 8065 to the wordpress container's port 80 (which works fine on my local machine and some other machines) So as you could see above docker has properly done the mapping I assume.
To test the setup from the instance, when I run curl http://localhost:8065
the terminal responds curl: (52) Empty reply from server
Since I can't make the internal mapping work, its useless to map from outside also. However I've made new ingress and egress firewall rules to enable tcp:8065 for this instance. However still no luck.
I'm aware that GCP recommends to use their Kubernates Engine to deploy containerized apps. However switching to that option is not the solution I'm expecting here. I just want to make sure what went wrong and how to make the current setup work in the same platform.
This was an issue with the Wordpress and DB Docker setup; apache2 wasn't starting inside docker container.
To debug the issue I ran docker-compose up without -d so it reflects most of the issues.
You should "Allow HTTP traffic" and "Allow HTTPS traffic".
Go to your VM Instances, edit the instance and check the "Allow HTTP traffic" and "Allow HTTPS traffic" boxes. It will map outside VM traffic to it, and docker will handle it internally.