Docker容器在不同的主机上改变行为

我使用不同的工具(sentinelsat et sen2cor)build造docker集装箱:

#Modified Ubuntu docker image, adding some dependencies #Starting image FROM ubuntu #Install of Anaconda2-4.2.0 (from docker anaconda : https://github.com/ContinuumIO/docker-images/tree/master/anaconda) RUN apt-get update --fix-missing && apt-get install -y wget bzip2 ca-certificates \ libglib2.0-0 libxext6 libsm6 libxrender1 \ git mercurial subversion RUN echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh && \ wget --quiet https://repo.continuum.io/archive/Anaconda2-4.2.0-Linux-x86_64.sh -O ~/anaconda.sh && \ /bin/bash ~/anaconda.sh -b -p /opt/conda && \ rm ~/anaconda.sh RUN apt-get install -y curl grep sed dpkg && \ TINI_VERSION=`curl https://github.com/krallin/tini/releases/latest | grep -o "/v.*\"" | sed 's:^..\(.*\).$:\1:'` && \ curl -L "https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini_${TINI_VERSION}.deb" > tini.deb && \ dpkg -i tini.deb && \ rm tini.deb && \ apt-get clean ENV PATH /opt/conda/bin:$PATH RUN conda update conda -y RUN apt-get install -y zip #Sentinelsat install (https://github.com/ibamacsr/sentinelsat) RUN pip install sentinelsat #Sen2cor install (from lvhengani : https://github.com/lvhengani/sen2cor_docker) ENV SEN2COR_VERSION='2.3.1' RUN wget http://step.esa.int/thirdparties/sen2cor/${SEN2COR_VERSION}/sen2cor-${SEN2COR_VERSION}.tar.gz && \ tar -xvzf sen2cor-${SEN2COR_VERSION}.tar.gz && \ cd sen2cor-${SEN2COR_VERSION} && \ /bin/echo -e "y\ny\ny\n" | python setup.py install RUN rm sen2cor-${SEN2COR_VERSION}.tar.gz && rm -r /sen2cor-${SEN2COR_VERSION} #Path environment variables for sen2cor to allow use of sen2cor in command lines, useless with webpage ENV SEN2COR_HOME=/root/sen2cor ENV SEN2COR_BIN=/opt/conda/lib/python2.7/site-packages/sen2cor-${SEN2COR_VERSION}-py2.7.egg/sen2cor ENV GDAL_DATA=/opt/conda/lib/python2.7/site-packages/sen2cor-${SEN2COR_VERSION}-py2.7.egg/sen2cor/cfg/gdal_data #Install of Apache2 , PHP7 and MySQL RUN DEBIAN_FRONTEND=noninteractive && \ apt-get update && \ apt-get upgrade -y && \ apt-get install -y --no-install-recommends iproute2 apache2 php7.0 libapache2-mod-php7.0 \ php7.0-mysql php7.0-sqlite php7.0-bcmath php7.0-curl ca-certificates && \ apt-get autoremove -y && \ rm -rf /var/lib/apt/lists/* && \ echo "ServerName $(ip route get 8.8.8.8 | awk '{print $NF; exit}')" >> /etc/apache2/apache2.conf && \ a2enmod php7.0 && \ a2enmod rewrite && \ a2enmod env && \ sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php/7.0/apache2/php.ini RUN ln -sf /dev/stdout /var/log/apache2/access.log \ && ln -sf /dev/stderr /var/log/apache2/error.log ENV APACHE_RUN_USER www-data ENV APACHE_RUN_GROUP www-data ENV APACHE_LOG_DIR /var/log/apache2 ENV APACHE_LOCK_DIR /var/lock/apache2 ENV APACHE_PID_FILE /var/run/apache2.pid #Allow PHP to use sen2cor, repositories where sen2cor has to write logs RUN chown www-data:www-data /opt/conda/lib/python2.7/site-packages/sen2cor-2.3.1-py2.7.egg/ && \ chown www-data:www-data /root/ && \ chown www-data:www-data /root/sen2cor/ # Adding modified configuration files to allow Apache to access env variables from Sen2cor ADD ./conf_files/environment /etc/ ADD ./conf_files/envvars /etc/apache2/ #Move php files to apache repo COPY ./web_page /var/www/html/ RUN rm /var/www/html/index.html RUN chown www-data:www-data /var/www/html/ && \ mkdir /var/www/html/downloads && \ chown www-data:www-data /var/www/html/downloads/ #CMD /usr/sbin/apache2ctl -D FOREGROUND 

我遇到的问题是,当在我的笔记本电脑上使用Docker工具箱在这个configuration上运行时:

  $ docker version Client: Version: 17.05.0-ce API version: 1.29 Go version: go1.7.5 Git commit: 89658be Built: Fri May 5 15:36:11 2017 OS/Arch: windows/amd64 Server: Version: 17.06.0-ce API version: 1.30 (minimum version 1.12) Go version: go1.8.3 Git commit: 02c1d87 Built: Fri Jun 23 21:51:55 2017 OS/Arch: linux/amd64 Experimental: false 

容器完美地执行PHP所要求的操作。 我想在这个configuration的虚拟机上运行这个容器:

  DISTRIB_ID=Ubuntu DISTRIB_RELEASE=14.04 DISTRIB_CODENAME=trusty DISTRIB_DESCRIPTION="Ubuntu 14.04 LTS" 

和这个dockerconfiguration:

  Client: Version: 17.06.0-ce API version: 1.30 Go version: go1.8.3 Git commit: 02c1d87 Built: Fri Jun 23 21:19:16 2017 OS/Arch: linux/amd64 Server: Version: 17.06.0-ce API version: 1.30 (minimum version 1.12) Go version: go1.8.3 Git commit: 02c1d87 Built: Fri Jun 23 21:17:13 2017 OS/Arch: linux/amd64 Experimental: false 

当容器尝试访问repo / root / sen2cor /创build日志时,我有权限问题。 repo / root /和/ root / sen2cor都具有需要由PHP写入的权限。

我尝试使用两个chmod 777 ,它不能解决问题。

我也尝试过在Windows,17.04和17.05版本的Docker上使用不同版本的Docker,并且容器在两个版本上都能很好地工作。

我已经尝试使用sudo docker run ..在虚拟机上,我也尝试添加一个用户到docker组,然后docker run ..和我有相同的权限问题。

我什至尝试build立在我的Windows设置的图像(testing它,它的工作),然后上载dockerhub并从虚拟机中运行它,但它仍然有权限问题。

有任何想法吗 ?

find解决scheme,我只需要安装Sen2cor到另一个存储库。 我不知道为什么,但sen2cor默认安装在/ root / sen2cor中,所以我不得不用/bin/echo -e "y\ny\ny\n" | python setup.py install 通过/bin/echo -e "y\nn\n/var/www/html/sen2cor\ny\ny\n" | python setup.py install在“installation sen2cor”上安装/bin/echo -e "y\ny\ny\n" | python setup.py install命令。 /bin/echo -e "y\nn\n/var/www/html/sen2cor\ny\ny\n" | python setup.py install ,Apache可以访问它运行它。

我仍然不知道为什么容器是在主机上工作,而不是在另一个主机上工作,如果它来自Docker,这是有问题的。