首页 > 解决方案 > 无法在 docker 容器上启动 cassandra

问题描述

我无法在 docker 容器上启动 cassandra,似乎是权限问题。请提出替代方案。

参考日志:

*Created container adf1efd4de6eb8030a1963089715a80a0ec8e5f2cc1f1f50d867cab7d33c4920, for #26
19:15:08 Starting container with:
19:15:08 CMD:'',
19:15:08 Entrypoint:
19:15:08 '/bin/sh','/tmp/executor.sh',
19:15:08 Started container adf1efd4de6eb8030a1963089715a80a0ec8e5f2cc1f1f50d867cab7d33c4920
19:15:08 Starting script executor 19:15:08 Creating group... 19:15:09 Creating user...
19:15:09 * Cassandra is not running
19:15:09 /etc/init.d/cassandra: 71: ulimit: error setting limit (Operation not permitted)
19:15:09 /etc/init.d/cassandra: 72: ulimit: error setting limit (Operation not permitted)
19:15:09 install: cannot change owner and permissions of '/var/run/cassandra': No such file or directory
19:15:10 start-stop-daemon: unable to set gid to 106 (Operation not permitted) 19:15:20 * Cassandra is not running
19:15:20 Connection error: ('Unable to connect to any servers', {'127.0.0.1': error(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")})
19:15:20 Removing container adf1efd4de6eb8030a1963089715a80a0ec8e5f2cc1f1f50d867cab7d33c4920*

码头工人文件:

FROM hub.docker.prod.walmart.com/library/ubuntu:14.04

ENV DEBIAN_FRONTEND=noninteractive
ENV http_proxy http://gec-proxy-svr.homeoffice.wal-mart.com:8080
ENV https_proxy http://gec-proxy-svr.homeoffice.wal-mart.com:8080
RUN apt-get update -y
RUN apt-get install -y software-properties-common debconf-utils
RUN add-apt-repository ppa:webupd8team/java
RUN apt-get update -y
RUN echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
RUN apt-get install -y oracle-java8-installer
RUN echo "deb http://www.apache.org/dist/cassandra/debian 22x main" | tee -a /etc/apt/sources.list.d/cassandra.sources.list
RUN echo "deb-src http://www.apache.org/dist/cassandra/debian 22x main" | tee -a /etc/apt/sources.list.d/cassandra.sources.list

RUN gpg --keyserver pgp.mit.edu --recv-keys F758CE318D77295D \
&& gpg --export --armor F758CE318D77295D | apt-key add -
RUN gpg --keyserver pgp.mit.edu --recv-keys 2B5C1B00 \
&& gpg --export --armor 2B5C1B00 | apt-key add -
RUN gpg --keyserver pgp.mit.edu --recv-keys 0353B12C \
&& gpg --export --armor 0353B12C | apt-key add -
RUN apt-get update -y
EXPOSE 9042
RUN apt-get install --quiet --yes --force-yes cassandra
#RUN sleep 10s
#RUN service cassandra start
#RUN sleep 10s
#RUNservice cassandra status

标签: dockercassandra

解决方案


我在这里将您的 Dockerfile 与 Docker Hub 进行了比较: https ://github.com/docker-library/cassandra/blob/master/3.11/Dockerfile

(页面层次结构中的更高版本可以根据需要提供不同的版本。)

Dockerfile 中有大部分元素,但有一些命令可以在官方 Dockerfile 中创建目录。

你可以用这个官方的作为替代。


推荐阅读