본문 바로가기
OS/Ubuntu

Linux-ubuntu docker 확인 및 삭제하는 방법

by 아우럼 2024. 8. 6.
반응형

Docker를 많이 사용하지만 삭제하는 경우도 있으므로 자세한 방법을 소개 합니다.

 

Linux-ubuntu docker 확인및 삭제하는 방법

이해도를 높히기 위해서 명령어 뿐만 아니라 실행결과도 작성했습니다.

 

1. docker 가 설치되어 있다면 버전을 확인하세요.

aurumguide@ubuntu:~$ sudo docker -v
Docker version 25.0.2, build 29cf629

 

2. docker의 전체 정보를 확인할수 있습니다.

aurumguide@ubuntu:~$ sudo docker -v
Docker version 25.0.2, build 29cf629
aurumguide@ubuntu:~$ sudo docker info
Client: Docker Engine - Community
 Version:    25.0.2
 Context:    default
 Debug Mode: false
 -- 생략 --

 

3. docker가 실행중인지 확인 하세요. 

aurumguide@ubuntu:~$ sudo docker ps -a
CONTAINER ID   IMAGE         COMMAND    CREATED        STATUS                    PORTS     NAMES
2a1971289066   hello-world   "/hello"   7 months ago   Exited (0) 7 months ago             awesome_fermi
1e4f9602348f   hello-world   "/hello"   7 months ago   Exited (0) 7 months ago             romantic_gates

 

4. 아래 명령으로 Docker의 엔진 삭제 하는 작업입니다.

aurumguide@ubuntu:~$ sudo apt-get purge -y docker-engine docker docker.io docker-ce docker-ce-cli
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done 
-- 생략 -- 


aurumguide@ubuntu:~$ sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done 
-- 생략 --

 

5. docker의 모든 이미지, 컨테이너 및 볼륨을 삭제.

aurumguide@ubuntu:~$ sudo rm -rf /var/lib/docker /etc/docker
aurumguide@ubuntu:~$ sudo rm /etc/apparmor.d/docker 
aurumguide@ubuntu:~$ sudo groupdel docker
aurumguide@ubuntu:~$ sudo rm -rf /var/run/docker.sock

 

6. 설치시 snap로 설치 했다면 시스템에서  Docker를 제거 해주세요.

aurumguide@ubuntu:~$ sudo snap remove docker

 

7. docker 삭제 됐는지 확인합니다.

aurumguide@ubuntu:~$ sudo docker -v
sudo: docker: command not found
aurumguide@ubuntu:~$ sudo  docker info
sudo: docker: command not found
aurumguide@ubuntu:~$ sudo docker ps -a
sudo: docker: command not found

 

반응형