0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

WSL上でDockerを使う場合、Windows側ディスク容量が圧迫されることへの対処

Last updated at Posted at 2025-05-07

概要

WSLでDockerを使っているとWindows側のディスクを圧迫していく。その時の解消方法を以下にメモする(2025/05/02時点の方法)

基本的には1.と2.の手順で不要なものを削除し、3.で仮想ディスクを圧縮させれば良さそう。

環境

エディション	Windows 11 Home
バージョン	24H2
WSL バージョン: 2.4.13.0
カーネル バージョン: 5.15.167.4-1
WSLg バージョン: 1.0.65
MSRDC バージョン: 1.2.5716
Direct3D バージョン: 1.611.1-81528511
DXCore バージョン: 10.0.26100.1-240331-1435.ge-release
Windows バージョン: 10.0.26100.3915
Description:    Ubuntu 24.04.2 LTS
Docker version 28.1.1, build 4eba377

1.不要なDockerイメージの削除

  • docker imageの<none>を削除する。WSLにかかわらずDockerを使う場合は定期的にdocker imagesコマンドを実行して<none>があれば以下のコマンドを実行して削除する。
    • <none>以外は通常のdocker rmiコマンドなどで削除すればよい。
docker rmi $(docker images -q --filter "dangling=true")

2.Docker build cacheの削除

  • 以下の記事参照

3.WSLファイルの開放

  • 上記2つの手法を実行しただけではWSLの仮想ディスクは肥大化したままなので、以下の記事を参考にディスクの圧縮する。

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?