Skip to content

Instantly share code, notes, and snippets.

@cesarmiquel
Last active June 4, 2021 01:52
Show Gist options
  • Save cesarmiquel/e399332b2c11b22483527c37f19704d1 to your computer and use it in GitHub Desktop.
Save cesarmiquel/e399332b2c11b22483527c37f19704d1 to your computer and use it in GitHub Desktop.
Useful Docker commands

Useful Docker commands

System usage

Docker images and volues consume space on your computer. To get a birds eye of the usage do

$ docker system df

Which yields something like this:

$ docker system df 
TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              247                 27                  44.08GB             35.78GB (81%)
Containers          43                  5                   413.9MB             357.1MB (86%)
Local Volumes       383                 44                  83.1GB              72.25GB (86%)
Build Cache         0                   0                   0B                  0B

To sort images by size:

$ docker images --format "{{.ID}}\t{{.Size}}\t{{.Repository}}" | sort -k 2 -h
2cb0d9787c4d    1.85kB  hello-world                                                                                                                                                                             
6d1ef012b567    4.21MB  alpine                                                                                                                                                                                  
67f994af8639    4.81MB  gliderlabs/alpine                                                                                                                                                                       
b955fa398a69    4.82MB  alpine                                                                                                                                                                                  
d88a70313556    5.27MB  gliderlabs/alpine                                                                                                                                                                       
f5df0abec1ac    6MB     d4d/mu-memcached                                                                                                                                                                        
a64ac7d97ed6    6.27MB  d4d/mu-nginx                                                                                                                                                                            
0eaa2395ed48    6.92MB  memcached                                                                                                                                                                               
...
e7671d9424c2    911MB   node
c5f1efe092a0    912MB   node
adc3ac86765f    918MB   node
8118255d5cd9    978MB   api-backend_api-backend
4125aa86ea9a    1.44GB  devwithlando/pantheon-appserver

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment