简体   繁体   中英

Cannot connect to Wordpress docker container.on google cloud platform

Ok so I have read the other connecting to docker container questions and mine does not seem to fit any of the other ones. So here it goes. I have installed docker and docker compose. I built the Wordpress site on a my home machine and am not trying to migrate it to GCP. I got a micro instance and installed everything on there and as far as I can tell everything is up and running as it should be. But when I go to log into the site from the web browser I get -

**This site can’t be reached
xx.xxx.xx.xx refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED**

these are the ports opened up in my .yml file

- "8000:80"</b>
- "443"</b>
- "22"</b>

I have also tried 8080:80 and 80:80 to no availe

and when I check docker port it shows

 80/tcp -> 0.0.0.0:32770</br>
 80/tcp -> 0.0.0.0:8000</br>
 22/tcp -> 0.0.0.0:32771</br>
 443/tcp -> 0.0.0.0:443</br>

and when I check netstat from localhost and from another machine I get Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

tcp        0      0 127.0.0.1:17600         0.0.0.0:*      LISTEN      -               
tcp        0      0 127.0.0.1:17603         0.0.0.0:*      LISTEN      -               
tcp        0      0 127.0.0.1:3306          0.0.0.0:*      LISTEN      -               
tcp        0      0 127.0.1.1:53            0.0.0.0:*      LISTEN      -               
tcp        0      0 127.0.0.1:631           0.0.0.0:*      LISTEN      -               
tcp        0      0 0.0.0.0:17500           0.0.0.0:*      LISTEN      -               
tcp6       0      0 :::80                   :::*           LISTEN      -               
tcp6       0      0 ::1:631                 :::*           LISTEN      -               
tcp6       0      0 :::17500                :::*           LISTEN      -               
udp        0      0 0.0.0.0:49953           0.0.0.0:*                  -               
udp    22720      0 0.0.0.0:56225           0.0.0.0:*                  -               
udp    52224      0 127.0.1.1:53            0.0.0.0:*                  -               
udp    19584      0 0.0.0.0:68              0.0.0.0:*                  -               
udp    46080      0 0.0.0.0:17500           0.0.0.0:*                  -               
udp   214144      0 0.0.0.0:17500           0.0.0.0:*                  -               
udp    35072      0 0.0.0.0:5353            0.0.0.0:*                  -               
udp     9216      0 0.0.0.0:5353            0.0.0.0:*                  -               
udp        0      0 0.0.0.0:631             0.0.0.0:*                  -          
udp6       0      0 :::44824                :::*                       -               
udp6   16896      0 :::5353                 :::*                       -               
udp6    3840      0 :::5353                 :::*    

               - 

when I run docker ps I get:

CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS           
                                                                           NAMES
1c25a8707960        wordpress:latest    "docker-entrypoint.s…"   37 minutes ago      Up 37 minutes       0.0.0.0:443->443/
tcp, 0.0.0.0:32771->22/tcp, 0.0.0.0:8000->80/tcp, 0.0.0.0:32770->80/tcp   wp-site_wordpress_1
96f3c136c746        mysql:5.7           "docker-entrypoint.s…"   37 minutes ago      Up 37 minutes       3306/tcp         
                                                                          wp-site_wp-db_1

Also I have both http and https open on my google cloud firewall.

So if I am listening on port 80 and have it mapped to 8000(the port I was connecting to the container on on my dev machine) I do not understand why I can not get to the WP site in the browser. Any help would be greatly appreciated. Also I think I included everything needed for this question. If there is anything else I will be more than happy to post it .

Ok so after a lot of tries I finally figured it out. In the yml file I needed to take out port -"80" and change -"8000:80" to -"80:80" and then remove the old containers and rebuild them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM