在安装了Mono的Ubuntu映像的Dockerfile中构build时出错

我有下面的docker文件,我试图用来build立一个Ubuntu的单声道图像。

FROM ubuntu:14.04 MAINTAINER John Smith <John.Smith@gmail.com> RUN sudo apt-get update RUN sudo /bin/bash -l -c apt-get install wget RUN sudo /bin/bash -l -c apt-get http://download.mono-project.com/repo/xamarin.gpg RUN sudo apt-key add xamarin.gpg RUN sudo echo "deb http://download.mono-project.com/repo/debian wheezy main" > /etc/apt/sources.list.d/mono-xamarin.list RUN sudo apt-get update RUN sudo apt-get install mono-complete 

当我运行下面的docker build命令…

 docker build -t="test/mono" . 

它build立失败,并提供以下错误消息:

 gpg:can't open 'xamaring.gpg': No such file or directory. 2015/05/27 16:11:01 The command [/bin/bash -c sudo apt-key add xamarin.gpg] returned a non-zero code: 2 

任何明显错误突出?

看起来你忘了在安装wget之后忘记使用wget而不是apt-get,所以'xamaring.gpg'还没有被下载,这就是为什么它不能被find。

你需要这个:

 /bin/bash -l -c "wget http://download.mono-project.com/repo/xamarin.gpg" 

这是在docker的网站这个例子:

Dockerizing MongoDB