是否可以通过在docker中运行apache来获取远程ip
我已经在docker中创建了一个apache服务器,但是我在访问日志中得到的ip只是来自我的docker ip,而不是来自远程客户端ip 有可能获得远程ip吗 我尝试使用mod_remoteip,但它不起作用。Dockerfile是否可以通过在docker中运行apache来获取远程ip,docker,apache2,Docker,Apache2,我已经在docker中创建了一个apache服务器,但是我在访问日志中得到的ip只是来自我的docker ip,而不是来自远程客户端ip 有可能获得远程ip吗 我尝试使用mod_remoteip,但它不起作用。Dockerfile FROM ubuntu:latest ENV DEBIAN_FRONTEND noninteractive # make sure the package repository is up to date and update ubuntu RUN locale-
FROM ubuntu:latest
ENV DEBIAN_FRONTEND noninteractive
# make sure the package repository is up to date and update ubuntu
RUN locale-gen de_DE.UTF-8
RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
RUN apt-get update && apt-get install -y apt-transport-https ca-certificates
RUN apt-get update && apt-get install -y curl lsb-release supervisor openssh-server libapache2-mod-passenger git apache2 vim
# supervisor installation &&
# create directory for child images to store configuration in
RUN apt-get -y install supervisor && \
mkdir -p /var/run/sshd && \
mkdir -p /var/log/supervisor && \
mkdir -p /etc/supervisor/conf.d
# default command
CMD ["/usr/bin/supervisord"]
Dockerfile
FROM ubuntu:latest
ENV DEBIAN_FRONTEND noninteractive
# make sure the package repository is up to date and update ubuntu
RUN locale-gen de_DE.UTF-8
RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
RUN apt-get update && apt-get install -y apt-transport-https ca-certificates
RUN apt-get update && apt-get install -y curl lsb-release supervisor openssh-server libapache2-mod-passenger git apache2 vim
# supervisor installation &&
# create directory for child images to store configuration in
RUN apt-get -y install supervisor && \
mkdir -p /var/run/sshd && \
mkdir -p /var/log/supervisor && \
mkdir -p /etc/supervisor/conf.d
# default command
CMD ["/usr/bin/supervisord"]
您可以发布Dockerfile或docker运行命令来启动apache吗?我已经在我的apache映像上进行了测试,我可以在访问日志中看到外部IP地址。docker run-it-p 90:80 image\u id bash您可以发布Dockerfile或docker run命令来启动apache吗?我已经在我的apache映像上进行了测试,我可以在我的访问日志中看到外部IP地址。docker run-it-p90:80 image\u id bash运行docker后,我得到以下apache日志:172.17.42.1---[24/Sep/2015:15:42:24+0000]“get/HTTP/1.1”200 11764“-”curl/7.35.0“172.17.42.1”-[24/Sep/2015:15:42:26+0000]“get/HTTP/1.1”200 11764“-”“curl/7.35.0”172.17.42.1--[24/Sep/2015:15:42:29+0000]“GET/HTTP/1.1”200 11764--“curl/7.35.0”172.17.42.1--[24/Sep/2015:15:42:31+0000]“GET/HTTP/1.1”200 11764--“curl/7.35.0”在运行docker之后,我只得到以下apache日志:172.17.42.1--[24/Sep/2015:15:42:24:24+0000]“GET/HTTP/1.1”200 11764--“curl.0”“172.17.42.1——[24/Sep/2015:15:42:26+0000]“GET/HTTP/1.1”200 11764-“curl/7.35.0”172.17.42.1——[24/Sep/2015:15:42:29+0000]“GET/HTTP/1.1”200 11764-“curl/7.35.0”172.17.42.1——[24/Sep/2015:15:42:31+0000]“GET/HTTP/1.1”200 11764-“curl/7.35.0”