我正在使用Dockerfile并且无法传递此错误。我已经研究了很多关于错误的内容,但似乎无法找到解决方案。
代码:
来自ubuntu:可信赖
RUN echo "deb http://www.apache.org/dist/cassandra/debian 36x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
RUN sudo apt-get install -y curl nginx
RUN sudo apt-get update
RUN curl https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
RUN sudo apt-get update
RUN sudo apt-get install cassandra
RUN sudo service cassandra -fR
错误:...
E: Unable to locate package curl
E: Unable to locate package nginx
The command '/bin/sh -c sudo apt-get install -y curl nginx' returned a non-zero code: 100
即使我正在安装curl和nginx。请帮忙
答案 0 :(得分:2)
在安装curl之前运行apt-get update
。执行curl安装时,包列表不是最新的。此外,您必须让openjdk-8-jre-headless
信任才能安装cassandra:
FROM ubuntu:trusty
RUN echo "deb http://www.apache.org/dist/cassandra/debian 36x main" | tee -a /etc/apt/sources.list.d/cassandra.sources.list
RUN apt-get update
RUN apt-get install -y software-properties-common && add-apt-repository ppa:openjdk-r/ppa -y && apt-get update
RUN apt-get install -y curl nginx
RUN curl https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add - && sudo apt-get update
RUN apt-get install -y cassandra
RUN service cassandra start