Skip to content

nginx's remote_addr always be the docker0 bridge ip #27

Open

Description

@chenjie4255

I pull down this image and run as following comand:

docker run --name redirect -v ~/temp/nginx/www:/usr/share/nginx/html:ro -v ~/temp/nginx/nginx.conf:/etc/nginx/nginx.conf:ro -p 8888:80 10.20.132.153:5000/nginx

the nginx run well,
but when I check the access.log in /var/log/nginx/access.log, I found out that all the client ip($remote_addr) is the ip of docker0 bridge of the host.

I also try with this command but the issus is still.

# change -p 8888:80 to --net host
docker run --name redirect -v ~/temp/nginx/www:/usr/share/nginx/html:ro -v ~/temp/nginx/nginx.conf:/etc/nginx/nginx.conf:ro --net host 10.20.132.153:5000/nginx

Activity

  1. kaililleby commented on May 11, 2016

    @kaililleby

    did you ever figur this out?

  2. aderounmu-apg commented on Mar 30, 2023

    @aderounmu-apg

    Anyone with a solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions