0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

docker command まとめ

Last updated at Posted at 2021-02-27

いつも忘れるからメモ、特に新しいことはありません。

使用していない Docker オブジェクトの削除(prune)

# イメージの prune
$ docker image prune
# 既存のコンテナ~使われていないイメージすべてを削除する
$ docker image prune -a
# 既存のコンテナ~使われていないイメージすべてを削除する、確認もしない
$ docker image prune -a -f
$ docker image prune -a --filter "until=24h"

# コンテナの prune
$ docker container prune
$ docker container prune --filter "until=24h"

# ボリュームの prune
$ docker volume prune
$ docker volume prune --filter "label!=keep"

# ネットワークの prune
$ docker network prune
$ docker network prune --filter "until=24h"

# 全てを prune
$ docker system prune
$ docker system prune -a
# Docker 17.06.1 以上でボリュームも削除したい場合は、 --volumes フラグを使います
$ docker system prune --volumes 

DockerのBuild Cacheの削除

$ docker builder prune

Docker 版 df

$ docker system df
TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              5                   2                   2.884GB             343.2MB (11%)
Containers          2                   2                   301kB               0B (0%)
Local Volumes       0                   0                   0B                  0B
Build Cache         0                   0                   0B                  0B

コンテナの中身を覗く

$ docker ps -a
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS              PORTS                                       NAMES
5ed47462ec5b        wnameless/oracle-xe-11g-r2   "/bin/sh -c '/usr/sb乧"   9 months ago        Up 2 months         22/tcp, 8080/tcp, 0.0.0.0:49161->1521/tcp   oracle11g
7ff96800acc6        mysql:5.7.28                 "docker-entrypoint.s乧"   14 months ago       Up 2 months         0.0.0.0:3306->3306/tcp, 33060/tcp           mysql_host

$ docker inspect mysql_host
...........

以上

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?