Windows11下清理Docker Desktop与wsl的C盘空间占用_wsl清理缓存

Images:所有镜像占用的空间,包括拉取下来的镜像,和本地构建的。

Containers:运行的容器占用的空间,表示每个容器的读写层的空间。

Local Volumes:容器挂载本地数据卷的空间。

Build Cache:镜像构建过程中产生的缓存空间(只有在使用 BuildKit 时才有,Docker 18.09 以后可用)。

RECLAIMABLE :可回收大小。

//【镜像的磁盘占用】
//列出所有悬挂状态的镜像:docker image ls -f dangling=true
//1-删除镜像
docker image prune 或者 docker image rm $(docker image ls -f dangling=true -q)

//【数据卷的磁盘占用】
//2-删除不再使用的数据卷
docker volume prune 或者 docker volume rm $(docker volume ls -q)

//【Build Cache 的磁盘占用】
//3-删除 build cache磁盘占用
docker builder prune

//【4-一键清理】
docker system prune


![在这里插入图片描述](https://img-blog.csdnimg.cn/48adfb2711d946e59bb1e23e6988abed.png#pic_center)


### 二、清理wsl的磁盘占用



//1-可以先使用命令行来检查它的状态:
wsl -l -v
或者
wsl --list -v
或者
wsl.exe --list --verbose

//2-如果

  • 15
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Docker Desktop with WSL (Windows Subsystem for Linux) allows you to run Docker containers on Windows using a Linux distribution. By integrating Docker with WSL, you can leverage the benefits of both Docker and WSL to develop and run containerized applications on your Windows machine. To get started with Docker Desktop and WSL, you need to follow these steps: 1. Install Docker Desktop: Download and install Docker Desktop for Windows from the Docker website. Make sure to enable the WSL 2 backend during installation. 2. Enable WSL: Open PowerShell as an administrator and run the following command to enable WSL: ``` wsl --install ``` This command will install WSL and Linux kernel updates on your Windows machine. 3. Choose a Linux distribution: Open the Microsoft Store, search for your preferred Linux distribution (e.g., Ubuntu, Debian), and install it. This distribution will be used by Docker to run containers. 4. Set WSL version: Open PowerShell as an administrator and run the following command to set WSL version 2 as default: ``` wsl --set-default-version 2 ``` 5. Configure Docker to use WSL: Open Docker Desktop, go to "Settings," select "General," and check the "Use the WSL 2 based engine" option. Then, select the WSL default distribution you installed in step 3. 6. Test Docker: Open a terminal (WSL) and run the following command to verify that Docker is working: ``` docker run hello-world ``` If everything is set up correctly, you should see a "Hello from Docker!" message. That's it! Now you can start running Docker containers using the Linux distribution installed through WSL. Remember that you can also access files and directories on your Windows machine from within the Linux environment to build and run your containerized applications.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值