dockergoogle-cloud-platformfirewall

Can't Access GCP Docker container


services:
  demoapi:
    container_name: demoapi
    image: demoapi:latest
    volumes:
      - ./demoapi:/app/demoapi
    environment:
      - TZ=Asia/Taipei
    ports:
      - "8090:8090"
  demoDB:
    image: mcr.microsoft.com/mssql/server:2022-latest
    container_name: demoDB
    user: root  
    networks:
      - demonetwork
    ports:
      - "1433:1433"
    environment:
      - ACCEPT_EULA=Y
      - SA_PASSWORD=P@ssword
      - TZ=Asia/Taipei
    volumes:
      - /mnt/c/dbdata:/var/opt/mssql/data
      # - C:/dbdata:/var/opt/mssql/data
    deploy:
      resources:
        limits:
          memory: 2GB
networks:
  demonetwork:
    driver: bridge

I use this docker-compose.yml deploy on GCP VM.

And I have created two VPC FireWall rule for TCP 1443 and 8090,the Destination filters IP ranges set the VM External IP.

The applicable to instances in FireWall rule contains VM instance.

Both external IP,1443 and 8090 can't connect. In ssh VM, the two container status is up.

How could I fix it?

I expect to connect the external IP on particular port.


Solution

  • I finally set the FireWall rule [Destination filters IP] to None. And do that

    1. Set FireWall rule target tags [xxxx]
    2. Set VM instance Network tags [xxxx]