0

我尝试使用以下方法获取 ip:

$request->getClientIp()

返回:

172.30.0.1而不是像210.110.98.180

在 docker-compose 中使用类似这样的东西

http:
    build:
      context: .
      dockerfile: ./Dockerfile
    volumes:
      - "./:/var/www/http/"
    ports:
      - "80:80"
4

1 回答 1

0

通过将其添加到 docker 网络来修复它。

http:
    build:
      context: .
      dockerfile: ./Dockerfile
    volumes:
      - "./:/var/www/http/"
    ports:
      - "80:80"
    networks:
      - bridge2

networks:
  bridge2:
    external: true
于 2020-12-19T15:08:52.167 回答