docker archlinux image: System has not been booted with systemd as init system (PID 1). Can't operate

Santhosh picture Santhosh · Mar 4, 2019 · Viewed 9k times · Source

I am using archlinux/base official image from docker hub.

I am trying to use systemctl and it says.

$ docker run --rm -it ac16c4b756ed systemctl start httpd     
System has not been booted with systemd as init system (PID 1). Can't operate.

How to solve this.

Answer

King Chung Huang picture King Chung Huang · Mar 4, 2019

If your goal is to run an Apache Web Server (httpd), you should use the httpd image.

Docker containers are generally meant to run a single process. So, you wouldn't normally design a container to run something like systemd as the root process, and then run httpd as a child process. You would just run httpd directly in the foreground. The httpd image does this.