0

I would like to run (to test if it works) nginx on my gcp vm instance with docker-compose. My docker-compose.yml looks like:

version: '3'
services:
  nginx:
    image: nginx:latest
    container_name: webserver
    restart: unless-stopped
    ports:
      - 8080:8080

On my gcp I allow for http and https trafics. When I start docker-compose I get:

Starting webserver ... done
Attaching to webserver
webserver | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
webserver | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
webserver | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
webserver | 10-listen-on-ipv6-by-default.sh: info: IPv6 listen already enabled
webserver | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
webserver | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
webserver | /docker-entrypoint.sh: Configuration complete; ready for start up
webserver | 2022/04/24 11:48:14 [notice] 1#1: using the "epoll" event method
webserver | 2022/04/24 11:48:14 [notice] 1#1: nginx/1.21.6
webserver | 2022/04/24 11:48:14 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6) 
webserver | 2022/04/24 11:48:14 [notice] 1#1: OS: Linux 4.19.0-20-cloud-amd64
webserver | 2022/04/24 11:48:14 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
webserver | 2022/04/24 11:48:14 [notice] 1#1: start worker processes
webserver | 2022/04/24 11:48:14 [notice] 1#1: start worker process 26

And when I visit my vm's external ip: EXTERNAL_IP:8080 in web browser I don't get any information about nginx installed. What else do I need to make sure nginx works properly?

EDIT: Problem solved. From weird reson, nginx wasn't starting on 8080 port but on 49154

Frendom
  • 508
  • 6
  • 24
  • Does this answer your question? [Can't open port 8080 on Google Compute Engine running Debian](https://stackoverflow.com/questions/25880703/cant-open-port-8080-on-google-compute-engine-running-debian) – DazWilkin Apr 24 '22 at 14:51
  • Do you have a firewall rule allowing the traffic to hit your instance on port 8080? Alternatively, if you are using the check boxes "Allow HTTP(S) traffic", did you add the port to an existing rule? – jabbson Apr 24 '22 at 15:34
  • @DazWilkin, jabbson yes, both boxes are checked (http + https) and in VPC rules this port is added (and this rule is added to all instances) – Frendom Apr 24 '22 at 17:11
  • @Frendom can you post the fix as an answer? – Nestor Daniel Ortega Perez Apr 25 '22 at 23:38

0 Answers0