podman 삭제

진웅·2025년 8월 19일

네, Podman으로 실행한 Redis와 systemd에 등록한 서비스들도 모두 깔끔하게 제거해드리겠습니다.

Podman Redis 및 systemd 서비스 완전 제거

1. 현재 실행 중인 Podman 컨테이너 확인

# 실행 중인 컨테이너 확인
podman ps

# 모든 컨테이너 확인 (중지된 것 포함)
podman ps -a

2. systemd 서비스 중지 및 비활성화

# Redis 관련 systemd 서비스 확인
systemctl --user list-units | grep -i redis
# 또는
systemctl list-units | grep -i redis

# 사용자 레벨 서비스인 경우
systemctl --user stop container-redis.service
systemctl --user disable container-redis.service

# 시스템 레벨 서비스인 경우
sudo systemctl stop container-redis.service
sudo systemctl disable container-redis.service

3. Podman 생성 systemd 서비스 파일 제거

# 사용자 레벨 서비스 파일 위치 확인 및 제거
ls ~/.config/systemd/user/ | grep -i redis
rm ~/.config/systemd/user/container-redis.service

# 시스템 레벨 서비스 파일 제거
sudo ls /etc/systemd/system/ | grep -i redis
sudo rm /etc/systemd/system/container-redis.service

4. systemd 데몬 리로드

# 사용자 레벨
systemctl --user daemon-reload

# 시스템 레벨
sudo systemctl daemon-reload

5. Redis 컨테이너 중지 및 제거

# Redis 컨테이너 중지
podman stop redis
# 또는 컨테이너 ID/이름으로
podman stop <container_name_or_id>

# Redis 컨테이너 제거
podman rm redis
# 또는
podman rm <container_name_or_id>

# 강제 중지 및 제거 (필요시)
podman rm -f redis

6. Redis 이미지 제거

# Redis 이미지 확인
podman images | grep redis

# Redis 이미지 제거
podman rmi redis:latest
# 또는 특정 태그
podman rmi redis:7-alpine

7. Podman 볼륨 및 네트워크 정리

# 사용하지 않는 볼륨 제거
podman volume prune

# 사용하지 않는 네트워크 제거
podman network prune

# Redis 전용 볼륨이 있다면
podman volume ls | grep redis
podman volume rm <redis_volume_name>

8. 전체 Podman 환경 정리

# 모든 중지된 컨테이너 제거
podman container prune

# 모든 사용하지 않는 이미지 제거
podman image prune -a

# 모든 것을 한번에 정리 (주의!)
podman system prune -a --volumes

9. Podman 완전 제거

# RHEL/CentOS/Fedora
sudo dnf remove podman podman-docker buildah skopeo containers-common

# Ubuntu/Debian
sudo apt-get remove --purge podman podman-docker buildah skopeo
sudo apt-get autoremove

# Podman 설정 디렉토리 제거
rm -rf ~/.local/share/containers/
rm -rf ~/.config/containers/
sudo rm -rf /etc/containers/

10. 확인

# systemd 서비스 확인
systemctl --user list-units | grep -i container
systemctl list-units | grep -i container

# Podman 관련 프로세스 확인
ps aux | grep -i podman

# 포트 사용 확인 (Redis 기본 포트 6379)
sudo netstat -tlnp | grep 6379
# 또는
sudo ss -tlnp | grep 6379

한번에 실행할 수 있는 스크립트

#!/bin/bash
echo "Redis systemd 서비스 중지 및 제거..."
systemctl --user stop container-redis.service 2>/dev/null
systemctl --user disable container-redis.service 2>/dev/null
sudo systemctl stop container-redis.service 2>/dev/null
sudo systemctl disable container-redis.service 2>/dev/null

echo "systemd 서비스 파일 제거..."
rm ~/.config/systemd/user/container-redis.service 2>/dev/null
sudo rm /etc/systemd/system/container-redis.service 2>/dev/null

echo "systemd 데몬 리로드..."
systemctl --user daemon-reload
sudo systemctl daemon-reload

echo "Redis 컨테이너 중지 및 제거..."
podman stop redis 2>/dev/null
podman rm -f redis 2>/dev/null

echo "Redis 이미지 제거..."
podman rmi $(podman images | grep redis | awk '{print $3}') 2>/dev/null

echo "완료!"

이제 깔끔하게 정리된 상태에서 Docker를 설치하고 Harbor를 설치할 수 있습니다!

profile
bytebliss

0개의 댓글