Skip to content

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

@chenjie4255

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions