从安装了 Mono 的 Ubuntu 图像的 Dockerfile 构建时出错

Error in build from Dockerfile for Ubuntu image with Mono installed

我有以下 docker 文件,我试图用它来构建 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" .

构建失败并给出以下错误消息:

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'还没有下载,所以找不到。

你需要这个:

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

docker 的网站中有一个例子:

Dockerizing MongoDB