Docker on Windows 10 Network Adapter Removel

起因

许久以前在windows 10上测试安装过docker fo windows版,container是通过hyper-v来运行的,而hyper-v安装以后会影响virtualbox的使用,加上手头还有macbook可以用来跑docker,所以卸掉了docker和hyper-v,近期发现c:\programdata\docker\windowsfilter占用了10几个g的空间,决定清理一下。

过程

  1. 管理员运行powershell直接删除报权限不足

    remove-item C:\ProgramData\Docker\windowsfilter\3382b801e4c7977bb6c8e704f05eb570a05d35a2c7a796b994eede270d8d7f77\Files>
    # 报错信息
    + Remove-Item .\Windows\
    + ~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : PermissionDenied: (c_sensor.inf:FileInfo) [Remove-Item], UnauthorizedAccessException
        + FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft.PowerShell.Commands.RemoveItemCommand
    Remove-Item : Cannot remove item C:\ProgramData\Docker\windowsfilter\3382b801e4c7977bb6c8e704f05eb570a05d35a2c7a796b994
    eede270d8d7f77\Files\Windows\INF\c_smartcard.inf: Access to the path 'c_smartcard.inf' is denied.
    At line:1 char:1
    ...
  2. 重新安装新的docker for windows,执行下列命令一无所获

    docker ps -a
    CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
    
    docker images -a
    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    
    docker volume ls
    DRIVER              VOLUME NAME
  3. 这个一串命令也没清理出空间来

    docker system prune
    WARNING! This will remove:
            - all stopped containers
            - all networks not used by at least one container
            - all dangling images
            - all build cache
    Are you sure you want to continue? [y/N] y
    Total reclaimed space: 0B
    docker container prune
    WARNING! This will remove all stopped containers.
    Are you sure you want to continue? [y/N] y
    Total reclaimed space: 0B
    
    docker image prune
    WARNING! This will remove all dangling images.
    Are you sure you want to continue? [y/N] y
    Total reclaimed space: 0B
    
    docker network prune
    WARNING! This will remove all networks not used by at least one container.
    Are you sure you want to continue? [y/N] y
    
    docker volume prune
    WARNING! This will remove all local volumes not used by at least one container.
    Are you sure you want to continue? [y/N] y
    Total reclaimed space: 0B
  4. 最后在docker界面执行出厂设置恢复正常

    Docker / Settings / Reset / Reset to factory defaults
  5. 卸载docker

  6. 卸载hyper-v并重启

    Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All
  7. 设备管理器里面卸载hyper-v网卡