Hi. This isn't really an issue. Feel free to close if it bothers you. Since there is no discussions section I'm posting here.
I'm trying to setup a docker environment that has a Red Hat 9 clone with the latest version of mongo and nginx, started as systemd services on which I can just get a shell or run diverse tests for a piece of software.
FROM eniocarboni/docker-rockylinux-systemd
ENV container docker
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
RUN echo -e "[mongodb-org-6.0]\nname=MongoDB Repository \nbaseurl=https://repo.mongodb.org/yum/redhat/9/mongodb-org/6.0/x86_64/ \ngpgcheck=1 \nenabled=1 \ngpgkey=https://www.mongodb.org/static/pgp/server-6.0.asc" > /etc/yum.repos.d/mongodb-org-6.0.repo
RUN dnf -y clean all && dnf -y group install "Development Tools" && dnf -y install mongodb-org nginx procps-ng; rm -rf /var/cache /var/log/dnf* /var/log/yum.*
RUN mkdir -p /data/db
RUN chmod -R 777 /data/db
VOLUME [ "/data/db" ]
EXPOSE 27017
RUN systemctl enable --now mongod
RUN . ~/.nvm/nvm.sh && nvm install --lts
EXPOSE 80
RUN systemctl enable --now nginx
COPY docker-entrypoint.sh /usr/local/bin/
RUN ["chmod", "+x", "/usr/local/bin/docker-entrypoint.sh"]
ENTRYPOINT ["docker-entrypoint.sh"]
#!/usr/bin/env bash
tail -f /dev/null
services:
application:
build: .
privileged: true
container_name: application
ports:
- 27017:27017
- 80:80
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /mnt/application/data/db:/data/db:rw
They're all in the same folder. I just run: docker compose up -d --build --remove-orphans
. The weird mounts are because of WSL, docker runs in WSL. I get this errore which I've already googled and looked at the rockylinux/almalinux/9-init github issue trackers to no avail.
=> ERROR [ 7/11] RUN systemctl enable --now mongod 0.4s
------
> [ 7/11] RUN systemctl enable --now mongod:
#0 0.366 System has not been booted with systemd as init system (PID 1). Can't operate.
#0 0.366 Failed to connect to bus: Host is down
------
failed to solve: executor failed running [/bin/sh -c systemctl enable --now mongod]: exit code: 1
How would I get over this ? Could you point me in the right direction ? I can get this working by just starting mongodb
and nginx
with (mongod &) && (nginx &) && tail...
but I need systemd