简体   繁体   English

无法连接到Google Cloud Platform上的Wordpress Docker Container。

[英]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. 好的,所以我读了其他关于docker容器的问题,而我的问题似乎不适合其他任何一个。 So here it goes. 所以就到这里。 I have installed docker and docker compose. 我已经安装了docker和docker compose。 I built the Wordpress site on a my home machine and am not trying to migrate it to GCP. 我在家用计算机上构建了Wordpress网站,但没有尝试将其迁移到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 这些是我的.yml文件中打开的端口

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

I have also tried 8080:80 and 80:80 to no availe 我也尝试了8080:80和80:80无济于事

and when I check docker port it shows 当我检查docker端口时显示

 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 当我从本地主机和另一台计算机检查netstat时,我获得了活动的Internet连接(仅服务器)Proto Recv-Q Send-Q本地地址外部地址状态PID /程序名称

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: 当我运行docker ps时,我得到:

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. 另外,我在Google云防火墙上同时打开了http和https。

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. 因此,如果我正在侦听端口80并将其映射到8000(我正在连接到我的开发机器上的容器的端口),我将不明白为什么无法在浏览器中访问WP站点。 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. 在yml文件中,我需要取出端口-“ 80”并将-“ 8000:80”更改为-“ 80:80”,然后删除旧容器并重建它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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