简体   繁体   English

将我的Docker容器暴露于GCP上的外部IP

[英]Expose my docker container to my external IP on GCP

We have a dockerized app that we imported on a Compute Engine instance with ubuntu 16.04. 我们有一个通过ubuntu 16.04在Compute Engine实例上导入的dockerized应用。 It contains a nginx reverse proxy running on port 80 and in /etc/hosts we've added 127.0.0.1 mydockerizedapp 它包含运行在端口80上的nginx反向代理,在/ etc / hosts中,我们添加了127.0.0.1 mydockerizedapp

The GCE got an external IP address. GCE获得了一个外部IP地址。 How can I set so that when I go on this external IP from a browser, I see the files served by the container nginx ? 我该如何设置,以便当我通过浏览器访问该外部IP时,可以看到容器nginx提供的文件?

You have to expose the ports of your container on the host machine by mapping it. 您必须通过映射在主机上公开容器的端口

If you use the cli: --port-mappings=80:80:TCP 如果使用cli:-- --port-mappings=80:80:TCP

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

相关问题 我无法在GCP Compute Engine上访问我的Docker容器 - I can't access my Docker container on GCP Compute Engine kubernetes将nginx暴露于gcp中的静态ip并带有入口服务配置错误 - kubernetes expose nginx to static ip in gcp with ingress service configuration error 通过我的 ip:host 不再工作访问我的容器 - accessing my container via my ip:host not working anymore 使用我的 angular 应用程序创建一个 docker 容器 - Create a docker container using my angular app 如何将 Nginx docker 容器指向我的 Web 应用程序的正确容器? - How to point Nginx docker container to the correct container for my web app? 如何从docker容器中获取外部主机ip地址 - How do I get the external hosts ip address from inside a docker container Docker - 每个单独的我的服务容器都有单独的 nginx 容器 - Docker - separate nginx container for every separate my service container 从我的Django应用容器中获取主机IP - Get the host IP from my django app container 如何在docker swarm上部署应用程序并将该IP地址暴露给A记录 - how to deploy applications on docker swarm and expose that ip address to A record 如何在安装了Nginx的情况下运行docker容器? - How can I run my docker container with installed Nginx?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM