-1

I am attempting to build influxdb from scratch, using it's rpm. In my scenario I can not use the prebuilt dockerhub image. I'm running into issues when I attempt to start influxdb inside the docker container using he command systemctl start influxdb.

I usually get the following error:

`System has not been booted with systemd as init system (PID 1). Can't operate.`

How can I start the influxdb service in the docker container?

Here my dockerfile:

FROM centos

COPY influxdb-1.7.0.x86_64.rpm /home
COPY influxdb.conf /etc/influxdb/influxdb.conf

WORKDIR /home

ENV INFLUXDB_VERSION 1.7

ARG INFLUXDB_CONFIG_PATH=/etc/influxdb/influxdb.conf

VOLUME /var/lib/influxdb
#VOLUME /sys/fs/cgroup:/sys/fs/cgroup:ro

EXPOSE 8086

RUN rpm -if influxdb-1.7.0.x86_64.rpm
#RUN systemctl start influxdb
CMD [ "/bin/bash" ]
Jeff Sikala
  • 69
  • 1
  • 1
  • 4
  • " In my scenario I can not use the prebuilt dockerhub image." Can you clarify on why this is? – PiRocks Jan 15 '21 at 16:51
  • 1
    @PiRocks that question was about running Docker and other services in WSL, not running inside Docker. Running systemd inside containers is not recommended (and except in extreme edge cases, there's no benefit to doing so). – Zac Anger Jan 15 '21 at 16:54

1 Answers1

1

There's not really any good reason to try to use systemd inside a container, since Docker itself (or Kubernetes, or whatever's running the containers) is managing the lifecycle. The official InfluxDB images, for example, basically just run influx. See also this answer for why it's not recommended to use systemd. If you can work out your issues with the official image, you'd have much better luck — but if not, you can build a similar image (see the link above).

Zac Anger
  • 6,983
  • 2
  • 15
  • 42