본문 바로가기

리눅스

[리눅스] docker ps filter 옵션

728x90

docker ps filter 옵션

컨테이너 이름 필터

docker ps -q --filter name=nginx

$ docker ps -q --filter name=nginx
6eaa629f3cde

docker rm -f `docker ps -aq --filter name=nginx`

$ docker rm -f `docker ps -aq --filter name=nginx`

docker rm -f `docker ps -aq --filter status=exited`

$ docker rm -f `docker ps -aq --filter status=exited`
83ca65ffc2b9

필터 옵션

docker system prune 명령

 사용하지 않는 데이터 제거

사용법

$ docker system prune --help

Usage:	docker system prune [OPTIONS]

Remove unused data

Options:
  -a, --all             Remove all unused images not just dangling ones
      --filter filter   Provide filter values (e.g. 'label=<key>=<value>')
  -f, --force           Do not prompt for confirmation
      --volumes         Prune volumes
728x90

매달린 이미지뿐만 아니라 사용하지 않는 모든 이미지 제거

docker system prune --all --volumes

$ docker system prune --all --volumes
WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all volumes not used by at least one container
  - all images without at least one container associated to them
  - all build cache

Are you sure you want to continue? [y/N] y
Deleted Networks:
nginx_default
...

Deleted Containers:
61beb0cf0bee0ff47347359959901df102c8ea59a3970cdff028459c513e6cb5
...

Deleted Volumes:
3605cdb129de6d589f7b3efe2f7e90504a35215b8d0e9a1c2651b4e5c7990572
...

Deleted Images:
untagged: nginx:1.15
untagged: nginx@sha256:23b4dcdf0d34d4a129755fc6f52e1c6e23bb34ea011b315d87e193033bcd1b68
...
deleted: sha256:174f5685490326fc0a1c0f5570b8663732189b327007e47ff13d2ca59673db02

Total reclaimed space: 11.1GB


$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

$ docker volume ls
DRIVER              VOLUME NAME

$ docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
d36fdc5e5cfb        bridge              bridge              local
8d26fac8b1d1        host                host                local
64e6a5935b61        none                null                local

 

docker system prune --all --force --volumes

 

참고사이트

- https://docs.docker.com/engine/reference/commandline/ps/

 

728x90