docker error无法找到包cowsay

时间:2016-05-08 11:55:30

标签: docker

当我运行build命令时:

$ docker build -t cowsay .
Sending build context to Docker daemon 3.072 kB
Step 1 : FROM
Unknown instruction: FROM
dev@ub:~/cowsay$ docker build -t cowsay .
Sending build context to Docker daemon 3.072 kB
Step 1 : FROM ubuntu:14.04
 ---> 90d5884b1ee0
Step 2 : RUN apt-get -y install cowsay
 ---> Running in 587aaba2824b
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package cowsay
The command '/bin/sh -c apt-get -y install cowsay' returned a non-zero code: 100

Dockerfile的内容如下:

FROM ubuntu:14.04
RUN apt-get -y install cowsay
RUN apt-get -y install fortune
ENTRYPOINT ["/usr/games/cowsay"]
CMD ["Docker is so awesomoooooooo!"]
ONBUILD RUN /usr/games/fortune | /usr/games/cowsay

如何避免此错误消息?

1 个答案:

答案 0 :(得分:1)

首先尝试添加RUN apt-get update

更新软件包后,您可以安装cowsay。

例如,请参阅this Dockerfile作为RUN apt-get命令的示例:

FROM debian:jessie

RUN apt-get update && apt-get install -y cowsay
COPY docker.cow /usr/share/cowsay/cows/docker.cow

ENTRYPOINT ["/usr/games/cowsay","-f","docker"]
CMD ["moby","dock"]