Skip to content

Commit 058f7df

Browse files
committed
docs: docker inspect --size
Signed-off-by: David Karlsson <[email protected]> Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit e064f89) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 226a2fd commit 058f7df

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

docs/reference/commandline/inspect.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,35 @@ The following example inspects a _volume_ named "myvolume"
4949
$ docker inspect --type=volume myvolume
5050
```
5151

52+
### <a name=size></a> Inspect the size of a container (-s, --size)
53+
54+
The `--size`, or short-form `-s`, option adds two additional fields to the
55+
`docker inspect` output. This option only works for containers. The container
56+
doesn't have to be running, it also works for stopped containers.
57+
58+
```console
59+
$ docker inspect --size mycontainer
60+
```
61+
62+
The output includes the full output of a regular `docker inspect` command, with
63+
the following additional fields:
64+
65+
- `SizeRootFs`: the total size of all the files in the container, in bytes.
66+
- `SizeRw`: the size of the files that have been created or changed in the
67+
container, compared to it's image, in bytes.
68+
69+
```console
70+
$ docker run --name database -d redis
71+
3b2cbf074c99db4a0cad35966a9e24d7bc277f5565c17233386589029b7db273
72+
$ docker inspect --size database -f '{{ .SizeRootFs }}'
73+
123125760
74+
$ docker inspect --size database -f '{{ .SizeRw }}'
75+
8192
76+
$ docker exec database fallocate -l 1000 /newfile
77+
$ docker inspect --size database -f '{{ .SizeRw }}'
78+
12288
79+
```
80+
5281
## Examples
5382

5483
### Get an instance's IP address

0 commit comments

Comments
 (0)