Converting an Ubuntu based Dockerfile to CentOS fails

Hi all,

I have successfully building the sebp/elk image which is based on an Ubuntu image: https://hub.docker.com/r/sebp/elk/~/dockerfile/ and I can run the container by running this command:

sudo docker run -p 5601:5601 -p 9200:9200 -p 5000:5000 -it --name elk sebp/elk

I am trying to convert the Dockerfile so it uses a CentOS base image instead of Ubuntu base image, so I replaced the first section:

Before

[CODE]FROM phusion/baseimage
MAINTAINER Sebastien Pujadas http://pujadas.net
ENV REFRESHED_AT 2017-01-13
ENV GOSU_VERSION 1.8

RUN set -x
&& apt-get update -qq
&& apt-get install -qqy --no-install-recommends ca-certificates curl
&& rm -rf /var/lib/apt/lists/*
&& curl -L -o /usr/local/bin/gosu “https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)”
&& curl -L -o /usr/local/bin/gosu.asc “https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc”
&& export GNUPGHOME="$(mktemp -d)"
&& gpg --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu
&& rm -r “$GNUPGHOME” /usr/local/bin/gosu.asc
&& chmod +x /usr/local/bin/gosu
&& gosu nobody true
&& apt-get update -qq
&& apt-get install -qqy openjdk-8-jdk
&& apt-get clean
&& set +x

After

FROM centos:latest
ENV GOSU_VERSION 1.10

RUN set -x
&& yum update -y
&& yum -y install epel-release
&& yum install -y ca-certificates curl dpkg
&& curl -L -o /usr/local/bin/gosu “https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)”
&& curl -L -o /usr/local/bin/gosu.asc “https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc”
&& export GNUPGHOME="$(mktemp -d)"
&& gpg --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu
&& rm -r “$GNUPGHOME” /usr/local/bin/gosu.asc
&& chmod +x /usr/local/bin/gosu
&& gosu nobody true
&& yum update -y
&& yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel
&& yum clean all
&& set +x

[CODE]
The image builds successfully but when I try to run it with the same docker run command (above), I get errors:

[2018-01-23T17:06:38,250][ERROR][logstash.inputs.beats ] Invalid setting for beats input plugin:

input {
beats {
# This setting must be a path
# File does not exist or cannot be opened /etc/pki/tls/private/logstash-beats.key
ssl_key => “/etc/pki/tls/private/logstash-beats.key”

}
}
[2018-01-23T17:06:38,325][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>“LogStash::ConfigurationError”, :message=>“Something is wrong with your configuration.”, :backtrace=>["/opt/logstash/logstash-core/lib/logstash/config/mixin.rb:89:in config_init'", "/opt/logstash/logstash-core/lib/logstash/inputs/base.rb:62:ininitialize’", “/opt/logstash/logstash-core/lib/logstash/plugins/plugin_factory.rb:90:in plugin'", "/opt/logstash/logstash-core/lib/logstash/pipeline.rb:114:inplugin’”, “(eval):8:in <eval>'", "org/jruby/RubyKernel.java:994:ineval’”, “/opt/logstash/logstash-core/lib/logstash/pipeline.rb:86:in initialize'", "/opt/logstash/logstash-core/lib/logstash/pipeline.rb:171:ininitialize’”, “/opt/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:40:in execute'", "/opt/logstash/logstash-core/lib/logstash/agent.rb:335:inblock in converge_state’”, “/opt/logstash/logstash-core/lib/logstash/agent.rb:141:in with_pipelines'", "/opt/logstash/logstash-core/lib/logstash/agent.rb:332:inblock in converge_state’”, “org/jruby/RubyArray.java:1734:in each'", "/opt/logstash/logstash-core/lib/logstash/agent.rb:319:inconverge_state’”, “/opt/logstash/logstash-core/lib/logstash/agent.rb:166:in block in converge_state_and_update'", "/opt/logstash/logstash-core/lib/logstash/agent.rb:141:inwith_pipelines’”, “/opt/logstash/logstash-core/lib/logstash/agent.rb:164:in converge_state_and_update'", "/opt/logstash/logstash-core/lib/logstash/agent.rb:90:inexecute’”, “/opt/logstash/logstash-core/lib/logstash/runner.rb:343:in block in execute'", "/opt/logstash/vendor/bundle/jruby/2.3.0/gems/stud-0.0.23/lib/stud/task.rb:24:inblock in initialize’”]}

I have tried it with gosu version 1.8 and 1.10 and both have the same error. Can you please help me figure out what I am doing wrong?

Thanks in advance

Note that if you use the code formatting tool built into these forums, your question will be easier to read and will be more likely to get an answer.

Thank you, I looked for the [code] tag but couldn’t find it…

maybe this

Thanks, I didn’t change anything though basically installed the same packages as Ubuntu, why the other Docker image works and not this one?

BTW I tried adding [CODE] formatting but it didn’t work.

i don’t know the technology… i researched others having the same issue and provided that info.

either the cert is NOT in the location it is supposed to be OR it is owned by the wrong user or group

you could look in the folder where it reports it is not found

# File does not exist or cannot be opened /etc/pki/tls/private/logstash-beats.key
ssl_key => “/etc/pki/tls/private/logstash-beats.key”