是否可以通过在docker中运行apache来获取远程ip

时间:2015-08-31 20:10:35

标签: docker apache2

我在docker中创建了一个apache服务器,但是访问日志中的ip只是来自我的docker ip,而不是来自远程客户端ip。

是否可以获得远程ip?

我尝试使用mod_remoteip,但它不起作用。

1 个答案:

答案 0 :(得分:0)

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"]