docker공부를 시작해보겠당.
$ sudo wget -qO- https://get.docker.com/ | sh
$ sudo curl -fsSL https://get.docker.com | sh
$ sudo apt update
$ sudo apt install -y \
ca-certificates \
curl \
gnupg \
lsb-release
$ sudo mkdir -p /etc/apt/keyrings
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
$ sudo apt update
$ sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
$ sudo systemctl start docker
$ sudo systemctl start docker
📢 이때
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
해당 오류가 발생할 수 있다.
만약 ubuntu 20.04 버전을 사용하는 경우 발생하는 오류다.
Ubuntu 20.04에서는 system daemon으로 부팅되는 게 아니라서 이 명령어를 못 쓴다.
나는 systemctl 대신에 service로 확인할 수 있었다.
$ sudo service --status-all
[ - ] apparmor
[ - ] apport
[ - ] atd
...
[-]로 docker가 비활성화 되어 있다.
$ sudo service docker start
* Starting Docker: docker
$ sudo service --status-all
...
[ - ] dbus
[ + ] docker
[ ? ] hwclock.sh
docker부분이 [+]로 채워졌다. 이제 도커를 실행해보면
$ sudo docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
오류 해결했다.
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest 216c552ea5ba 2 weeks ago 77.8MB
hello-world latest feb5d9fea6a5 13 months ago 13.3kB