我在尝试重建某些docker容器时遇到了非常奇怪的行为。构建在以下行失败:
COPY ./startup.sh /
我收到以下错误:
Step 15 : COPY ./startup.sh /
stat /var/lib/docker/aufs/mnt/03a7dbf0115dabea5d4cb0ee7ebc84fe79254066089e50e8a7fb55c0c31d8c8d/startup.sh: no such file or directory
该文件在当前目录中可用,也没有dockerignore文件:
$ ls -al
insgesamt 65032
drwxr-xr-x 2 user user 4096 Okt 18 14:50 .
drwxr-xr-x 11 user user 4096 Okt 17 17:33 ..
-rwxr--r-- 1 user user 89 Okt 18 15:12 build
-rwxr-xr-x 1 user user 17879 Mär 4 2016 catalina.sh
-rw-r--r-- 1 user user 3531 Okt 18 15:26 Dockerfile
-rw-r--r-- 1 user user 3470 Aug 2 14:13 Dockerfile.org
-rw-r--r-- 1 user user 44043922 Jul 4 09:40 deploy-1.0-SNAPSHOT.war
-rw-r--r-- 1 user user 0 Okt 18 14:50 foo
-rw-r--r-- 1 user user 309780 Mär 2 2016 jolokia.war
-rw-r--r-- 1 user user 111731 Jul 13 13:13 keyspace_3x.cql
-rwxr--r-- 1 user user 3551 Jul 5 14:06 startup.sh
-rw-r--r-- 1 user user 17227683 Mai 10 10:32 statusLogging.war
-rwxr-xr-x 1 user user 84 Jul 13 12:49 tools
-rwx------ 1 user user 4839500 Jul 13 13:33 tools-1.0-SNAPSHOT.jar
有两点我感兴趣:
看起来它与目的地有关。当我将COPY指令修改为这样的内容时:COPY ./startup.sh /foo.sh
它抱怨/var/lib/docker/aufs/mnt/.../foo.sh
不在那里。
将内容复制到其他导演中而不是/正常工作,如下面的说明:
COPY ./tomcat-users.xml / usr / local / tomcat / conf / COPY ./*.war / usr / local / tomcat / webapps /
这里真正奇怪的是,几周前构建工作正常,但现在它失败了,除了没有更改文件和文件夹。
任何帮助或指示将不胜感激。谢谢!
编辑:完整的dockerfile:
FROM java:7-jre
MAINTAINER user
ENV http_proxy http://xxx.xxx.xxx.x:8111
ENV https_proxy https://xxx.xxx.xxx.x:8111
ENV CATALINA_HOME /usr/local/tomcat
ENV PATH $CATALINA_HOME/bin:$PATH
RUN mkdir -p "$CATALINA_HOME"
WORKDIR $CATALINA_HOME
# see https://www.apache.org/dist/tomcat/tomcat-8/KEYS
#RUN gpg --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys \
# 05AB33110949707C93A279E3D3EFE6B686867BA6 \
# 07E48665A34DCAFAE522E5E6266191C37C037D42 \
# 47309207D818FFD8DCD3F83F1931D684307A10A5 \
# 541FBE7D8F78B25E055DDEE13C370389288584E7 \
# 61B832AC2F1C5A90F0F9B00A1C506407564C17A3 \
# 79F7026C690BAA50B92CD8B66A3AD3F4F22C4FED \
# 80FF76D88A969FE46108558A80B953A041E49465 \
# 8B39757B1D8A994DF2433ED58B3A601F08C975E5 \
# A27677289986DB50844682F8ACB77FC2E86E29AC \
# A9C5DF4D22E99998D9875A5110C01C5A2F6059E7 \
# B3F49CD3B9BD2996DA90F817ED3873F5D3262722 \
# DCFD35E0BF8CA7344752DE8B6FB21E8933C60243 \
# F3A04C595DB5B6A5F1ECA43E3B7BBB100D811BBE \
# F7DA48BB64BCB84ECBA7EE6935CD23C10D498E23
ENV TOMCAT_MAJOR 6
ENV TOMCAT_VERSION 6.0.45
ENV TOMCAT_TGZ_URL http://archive.apache.org/dist/tomcat/tomcat-$TOMCAT_MAJOR/v$TOMCAT_VERSION/bin/apache-tomcat-$TOMCAT_VERSION.tar.gz
RUN set -x \
&& curl -fSL "$TOMCAT_TGZ_URL" -o tomcat.tar.gz \
&& curl -fSL "$TOMCAT_TGZ_URL.asc" -o tomcat.tar.gz.asc \
&& tar -xvf tomcat.tar.gz --strip-components=1 \
&& rm bin/*.bat \
&& rm tomcat.tar.gz* \
&& apt-get update \
&& apt-get -y install mc \
&& apt-get -y install openssh-server \
&& apt-get install -yq gcc make openssl libssl-dev libapr1 libapr1-dev openjdk-7-jdk="$JAVA_DEBIAN_VERSION" \
&& tar zxf /usr/local/tomcat/bin/tomcat-native.tar.gz -C /tmp \
&& cd /tmp/tomcat-native*-src/jni/native/ \
&& ./configure --with-apr=/usr/bin/apr-1-config --with-java-home=/usr/lib/jvm/java-7-openjdk-amd64/ --with-ssl=yes --libdir=/usr/lib/jni \
&& make \
&& make install \
&& apt-get purge -y openjdk-7-jdk="$JAVA_DEBIAN_VERSION" gcc make libssl-dev libapr1-dev \
&& apt-get -y autoremove \
&& rm -rf /tmp/tomcat-native* \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /usr/local/tomcat/webapps/docs \
&& rm -rf /usr/local/tomcat/webapps/examples \
&& rm -rf /usr/local/tomcat/webapps/manager \
&& rm -rf /usr/local/tomcat/webapps/host-manager \
&& mkdir -p /var/run/sshd \
&& echo "session optional pam_umask.so umask=0002" >> /etc/pam.d/sshd \
&& sed -r -i "s/(^Subsystem.*)/#\1/" /etc/ssh/sshd_config \
&& echo "#Custom" >> /etc/ssh/sshd_config \
&& echo "Subsystem sftp internal-sftp" >> /etc/ssh/sshd_config \
&& echo "" >> /etc/ssh/sshd_config \
&& echo "Match Group sftp-user" >> /etc/ssh/sshd_config \
&& echo " ChrootDirectory /data/" >> /etc/ssh/sshd_config \
&& echo " ForceCommand internal-sftp" >> /etc/ssh/sshd_config \
&& groupadd sftp-user \
&& useradd -g sftp-user sftp-user
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
COPY ./startup.sh /
COPY ./tomcat-users.xml /usr/local/tomcat/conf/
COPY ./*.war /usr/local/tomcat/webapps/
COPY ./catalina.sh /usr/local/tomcat/bin/
EXPOSE 8080
EXPOSE 22
EXPOSE 7199
RUN rmdir /usr/local/tomcat/logs \
&& ln -s /arkadon/logs /usr/local/tomcat/logs \
&& ln -s /arkadon/logs /var/log/tomcat6
COPY ./tools* /usr/local/bin/
COPY keyspace* /
CMD ["/startup.sh"]
答案 0 :(得分:1)
首先尝试在另一台计算机或VM中构建Dockerfile。您的错误看起来像aufs图层中的损坏。如果它在另一台机器上成功,则需要清理docker。这个答案谈到了重置docker:click here
此致
答案 1 :(得分:0)
对于我的泊坞窗构建错误,
COPY failed: stat /<**path**> :no such file or directory
我通过重启docker服务来解决这个问题。
sudo service docker restart