Ubuntu版本更新错误与Docker和ElasticBeanstalk

我想了解为什么我不能在给定的Docker的Elastic Beanstalk 示例上升级Ubuntu版本。

这工作正常:

FROM ubuntu:12.04 RUN apt-get update RUN apt-get install -y nginx zip curl RUN echo "daemon off;" >> /etc/nginx/nginx.conf RUN curl -o /usr/share/nginx/www/master.zip -L https://codeload.github.com/gabrielecirulli/2048/zip/master RUN cd /usr/share/nginx/www/ && unzip master.zip && mv 2048-master/* . && rm -rf 2048-master master.zip EXPOSE 80 CMD ["/usr/sbin/nginx", "-c", "/etc/nginx/nginx.conf"] 

这不:

 FROM ubuntu:14.04 RUN apt-get update RUN apt-get install -y nginx zip curl RUN echo "daemon off;" >> /etc/nginx/nginx.conf RUN curl -o /usr/share/nginx/www/master.zip -L https://codeload.github.com/gabrielecirulli/2048/zip/master RUN cd /usr/share/nginx/www/ && unzip master.zip && mv 2048-master/* . && rm -rf 2048-master master.zip EXPOSE 80 CMD ["/usr/sbin/nginx", "-c", "/etc/nginx/nginx.conf"] 

日志文件给出:“返回一个非零代码:127”的错误。

命令失败,因为容器中没有/usr/share/nginx/www目录,但有/usr/share/nginx/html

  ---> 1911c575617e Step 4 : RUN curl -o /usr/share/nginx/www/master.zip -L https://codeload.github.com/gabrielecirulli/2048/zip/master ---> Running in d0ad1a5e7a3f % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Warning: Failed to create the file /usr/share/nginx/www/master.zip: No such Warning: file or directory 0 324k 0 867 0 0 1969 0 0:02:48 --:--:-- 0:02:48 1965 curl: (23) Failed writing body (0 != 867) INFO[0000] The command [/bin/sh -c curl -o /usr/share/nginx/www/master.zip -L https://codeload.github.com/gabrielecirulli/2048/zip/master] returned a non-zero code: 23 $ docker run --rm -ti 1911c575617e root@bfb101f5de87:/# ls -al /usr/share/nginx/www ls: cannot access /usr/share/nginx/www: No such file or directory root@bfb101f5de87:/# ls -al /usr/share/nginx total 12 drwxr-xr-x 3 root root 4096 May 23 11:04 . drwxr-xr-x 65 root root 4096 May 23 11:04 .. drwxr-xr-x 2 root root 4096 May 23 11:04 html 

提示: 最好的做法是使用相同的运行命令apt-get update && apt-get install 。 在创build时也总是尝试在相同的运行命令中删除临时文件:每个运行命令都会创build附加映像,因此,如果在一个运行命令中获取文件并在下一个文件中删除,则只会标记为已删除,但会不必要的增加图片大小 在我的大多数图像中,我使用了ubuntu / debian的单个运行命令:

 RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections \ && apt-get update -qq \ && apt-get install -y -qq ... \ ... && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*