본문 바로가기
etc/DOCKER

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

by 조조군 2020. 4. 30.
반응형

도커에서 systemctl 사용시 아래와 같은 에러를 볼수 있다. 

* 시스템이 초기화 시스템 (PID 1)로 systemd로 부팅되지 않았습니다. 작동 할 수 없습니다

 

[root@fb00f4e75552 bin]# systemctl start nginx 
System has not been booted with systemd as init system (PID 1). Can't operate. 
Failed to connect to bus: Host is down

 

가상화 시스템에서 나타나는 현상인데 도커파일을 생성하여 컨테이너를 실행시키거나

참고 : https://github.com/CentOS/CentOS-Dockerfiles/tree/master/systemd/centos7

 

CentOS/CentOS-Dockerfiles

Dockerfiles for various common implementations. Contribute to CentOS/CentOS-Dockerfiles development by creating an account on GitHub.

github.com

systemctl 사용이 가능한 centos 이미지를 받아서 사용하면 된다. 

PS D:\docker> docker pull centos/systemd
Using default tag: latest
latest: Pulling from centos/systemd
a02a4930cb5d: Pull complete                                                                                                                                                                                                                                                               c702ea4a22bc: Pull complete                                                                                                                                                                                                                                                               Digest: sha256:09db0255d215ca33710cc42e1a91b9002637eeef71322ca641947e65b7d53b58
Status: Downloaded newer image for centos/systemd:latest
docker.io/centos/systemd:latest

PS D:\docker> docker run --privileged -d --name appcentos centos/systemd init
98b6618b1fb6d0393be04df40ac06b60b7b524c94724c2043fb28a68e3b18f72
PS D:\docker> docker exec -it appcentos bash
[root@98b6618b1fb6 /]#

 

반응형

댓글