Update space.md

This commit is contained in:
paigehargrave 2019-01-20 13:50:31 -05:00 committed by GitHub
parent bb41fdbece
commit 5e715eabea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 28 additions and 22 deletions

View File

@ -1,47 +1,53 @@
--- ---
description: Disk space description: Disk utilization
keywords: mac, disk keywords: mac, disk
title: Disk space in Docker for Mac title: Disk utilization in Docker for Mac
--- ---
Docker for Mac stores Linux containers and images in a single large "disk image" file Docker for Mac stores Linux containers and images in a single, large "disk image" file
in the Mac filesystem. This is different to Docker on Linux which usually stores containers in the Mac filesystem. This is different from Docker on Linux, which usually stores containers
and images in the `/var/lib/docker` directory. and images in the `/var/lib/docker` directory.
## Where is the "disk image" file? ## Where is the "disk image" file?
To locate the "disk image" file, first click on the whale menu and then click on To locate the "disk image" file, first select the whale menu icon and then select
"Preferences...". When the preferences window appears, click on the "Disk" icon **Preferences...**. When the **Preferences...** window is displayed, select **Disk** and then **Reveal in Finder**:
and then "Reveal in Finder":
![Disk preferences](images/settings-disk.png) ![Disk preferences](images/settings-disk.png)
The preferences window also shows how much disk space the file is currently consuming. The **Preferences...** window shows how much actual disk space the "disk image" file is consuming.
In this example it is consuming only 2.4 GB out of a maximum of 64 GB. In this example, the "disk image" file is consuming 2.4 GB out of a maximum of 64 GB.
Note that other tools may display the space usage of the file incorrectly. Note that other tools might display space usage of the file in terms of the maximum file size, not the actual file size.
## If the file is too big ## If the file is too big
If the file is too big, you can If the file is too big, you can
- move it to a bigger drive; - move it to a bigger drive,
- delete unnecessary containers and images; or - delete unnecessary containers and images, or
- reduce the maximum size of the file. - reduce the maximum allowable size of the file.
### To move the file to a bigger drive ### To move the file to a bigger drive
To move the file, open the "Preferences..." menu, click on the "Disk" icon and then click To move the file, open the **Preferences...** menu, select **Disk** and then select
on "Move disk image". Do not move the file directly in the finder or Docker for Mac will on **Move disk image**. Do not move the file directly in the finder or Docker for Mac will
lose track of it. lose track of it.
### To delete unnecessary containers and images ### To delete unnecessary containers and images
To check whether you have too many unnecessary containers and images, first list images To check whether you have too many unnecessary containers and images:
with:
If your client and daemon API are version 1.25 or later (use the docker version command on the client to check your client and daemon API versions.), you can display detailed space usage information with:
```
docker system df -v
```
Alternatively, you can list images with:
```bash ```bash
$ docker image ls $ docker image ls
``` ```
then list containers with: and then list containers with:
```bash ```bash
$ docker container ls -a $ docker container ls -a
``` ```
@ -50,9 +56,9 @@ If there are lots of unneeded objects, try the command
```bash ```bash
$ docker system prune $ docker system prune
``` ```
This will remove all stopped containers, unused networks, dangling images and build cache. This removes all stopped containers, unused networks, dangling images, and build cache.
Note that it may take a few minutes before space becomes free on the host depending Note that it might take a few minutes before space becomes free on the host, depending
on what format the "disk image" file is in: on what format the "disk image" file is in:
- If the file is named `Docker.raw`: space on the host should be reclaimed within a few - If the file is named `Docker.raw`: space on the host should be reclaimed within a few
seconds. seconds.
@ -75,7 +81,7 @@ $ cd vms/0 # or com.docker.driver.amd64-linux
$ ls -klsh Docker.raw $ ls -klsh Docker.raw
2333548 -rw-r--r--@ 1 akim staff 64G Dec 13 17:42 Docker.raw 2333548 -rw-r--r--@ 1 akim staff 64G Dec 13 17:42 Docker.raw
``` ```
In this example the actual size of the disk is `2333548` KB, whereas the maximum size In this example, the actual size of the disk is `2333548` KB, whereas the maximum size
of the disk is `64` GB. of the disk is `64` GB.
### To reduce the maximum size of the file ### To reduce the maximum size of the file
@ -83,6 +89,6 @@ of the disk is `64` GB.
To reduce the maximum size of the file, first click on the whale menu and then click on To reduce the maximum size of the file, first click on the whale menu and then click on
"Preferences...". When the preferences window appears, click on the "Disk" icon. "Preferences...". When the preferences window appears, click on the "Disk" icon.
The preferences window contains a slider which allows the maximum disk size to be set. The preferences window contains a slider which allows the maximum disk size to be set.
If the maximum size is reduced, the current file will be deleted and therefore all **Warning**: If the maximum size is reduced, the current file will be deleted and, therefore, all
containers and images will be lost. containers and images will be lost.