Beth
Beth

Reputation: 11

Run Apache Cassandra in a Docker container

I am working on a Dockerfile and can not get passed this error. I have researched a lot about the error but cant seem to find a solution.

Code:
FROM ubuntu:trusty

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  

Error: ...

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  

Even though I am installing curl and nginx. Please help

Upvotes: 1

Views: 469

Answers (1)

Bertrand Martel
Bertrand Martel

Reputation: 45433

Run apt-get update before installing curl. The package list is not up-to-date when you perform curl installation. Also, you will have to get openjdk-8-jre-headless on trusty to get cassandra installed:

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

Upvotes: 2

Related Questions