Docker

wsl2 docker 설치 중 systemctl 관련 에러 System has not been booted with systemd as init system (PID 1). Can't operate.Failed to connect to bus: Host is down

하카데미 2023. 11. 29. 15:21

길벗 출판사에서 출판한 도커 교과서 내용 중 1.3 실습 환경 구축하기 부분 실행하면서 생긴 에러 해결 과정

 

도커 설치 과정 전체

# 1
sudo apt-get remove docker docker-engine docker.io containerd runc

# 2
sudo apt-get install

# 3 : 책 버전
# 책 40페이지에는 이렇게 나와 있는데 어째서인지 잘 안됨.. 그래서 일일이 설치
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common

# 3 : 일일이 버전
sudo apt-get install apt-transport-https
sudo apt-get install ca-certificates
sudo apt-get install curl
sudo apt-get install gnupg-agent
sudo apt-get install software-properties-common

# 4
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

# 5 : Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead 걍 무시하면 됨
sudo apt-key fingerprint 0EBFCD88

# 6
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

# 6번 오류 나면.. 아래 두줄 실행 후 다시 6번 실행
sudo apt update
sudo rm /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list

# 7
sudo apt-get update

# 8
sudo apt-get install docker-ce docker-ce-cli containerd.io

# 9
sudo curl -L "https://github.com/docker/compose/releases/download/v2.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

# 10
sudo chmod +x /usr/local/bin/docker-compose

# 11
docker version

# 12
sudo systemctl status docker

 

12번부터 에러 파티!

도커 설치는 됐는데, 뭐가 안되는 상황..

뜬금없이 갑자기 되서 오류 메세지 뜬 터미널 화면을 남겨두지 못함ㅠ

대신 터미널 히스토리라도..(오타 파티 인증🥲)

실제 터미널 히스토리 중..

 

 

윈도우 11에 wsl2 설치 후 docker 설치하면서  systemctl 오류 발생.

wsl 에서 systemctl, systemd ? 이런 걸 지원해주지 않아서 생기는 오류라고 함.

$ sudo systemctl status docker
[에러내용]
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

 

에러내용 전체를 검색어로 해서 모든 블로그 다 뒤져봤음.

다 wsl.conf 작성하고 재부팅하라는 내용..

sudo vim wsl.conf
# 작성할 내용은 아래 두줄
[boot]
systemd=true

vim 화면 캡처

 

재부팅 해도 계속 같은 에러 발생.

 

해결 방법

wsl --update

이젠 wsl에서 systemctl을 지원해준다고 한다..

 

도움이 된 블로그

https://parkkingcar.tistory.com/96

 

[Linux] systemctl 명령 에러 System has not been booted with systemd as init system (PID 1).

WSL을 사용 중 systemd 환경이 아니라는 오류가 발생합니다. $ sudo systemctl status System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down 원인은 WSL은 루트 시스템 프

parkkingcar.tistory.com

https://www.hakawati.co.kr/entry/WSL2-%EC%97%90%EC%84%9C-Systemd-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0

 

WSL2 에서 Systemd 사용하기

Overview WSL을 기본적으로 설치하면 sysvinit, 줄여서 init을 사용한다. 이는 오래된 시스템으로 centos 기준 6버전 이하, ubuntu 기준 12.04 이하 버전에서 사용해 왔다. 최신 리눅스 시스템은 init 대신 system

www.hakawati.co.kr

 

'Docker' 카테고리의 다른 글

도커 이미지 생성하기  (0) 2023.12.11
도커(Docker) 이미지 만들기  (0) 2023.12.07
도커 사용법  (0) 2023.11.30