You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Daniel Watford <da...@foomoo.co.uk> on 2023/07/18 07:29:17 UTC

Cleaning up docker file on ofbiz-vm1

Hi Jacques and all,

Following a request by Jacques to check on disk space used by Docker on our
demo sites server (ofbiz-vm1) I thought I would post the steps followed in
case they were of interest to others.

I opened a root terminal on ofbiz-vm1:
> ssh danwatford@ofbiz-vm1.apache.org
danwatford@ofbiz-vm1:~$ sudo bash

I then open a byobu session so I can resume working in case of
disconnection:
root@ofbiz-vm1:/home/danwatford# byobu

To check on disk space usage for the VM:
root@ofbiz-vm1:/home/danwatford# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        97G   77G   21G  79% /
devtmpfs         16G     0   16G   0% /dev
tmpfs            16G   88K   16G   1% /dev/shm
tmpfs           3.2G  1.6M  3.2G   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
<snip>

To check on disk space used by Docker:
root@ofbiz-vm1:/home/danwatford# docker system df
TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          106       6         49.22GB   47.17GB (95%)
Containers      9         8         252.7kB   0B (0%)
Local Volumes   23        23        705.7MB   0B (0%)
Build Cache     0         0         0B        0B

To clean up unused images and containers:
root@ofbiz-vm1:/home/danwatford# docker system prune
WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all dangling images
  - all dangling build cache

Are you sure you want to continue? [y/N] y
Deleted Containers:
aef9a0a458fa7ef3b7cb768def27a62396fd63b12471f30288e56c6cce473078


Deleted Images:
untagged:
ghcr.io/apache/ofbiz@sha256:50c7888fadfec413d34a85cf327c5843b63002d4fc27b78f25b515650dfe750c
deleted:
sha256:34fbbf005c3d52d7320018de3031b5b1fdb8b32aa1a380457f3e0703987cd04b
deleted:
sha256:b2a89e9375e86a94295e15aa531a4f49261d8ea993d402474b8d49f2463858d6
<snip>
deleted:
sha256:e6955d763fa7998204538aab84191f6540e3b5d00dfd674f42a3ae45235bff6a
deleted:
sha256:681f455f3bbb6d3076958b3696f0334c3121d35be69c350ebb3447c3af638761

Total reclaimed space: 46.36GB

The above command cleaned up 46 GB, mostly from unused cached container
images.

We can confirm that disk space has been reclaimed by checking df again:
root@ofbiz-vm1:/home/danwatford# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        97G   30G   68G  31% /

So available disk space increased from 21 GB to 68 GB due to the docker
clean up process.

We should install a cron job to run the clean up automatically.

Dan.

-- 
Daniel Watford

Re: Cleaning up docker file on ofbiz-vm1

Posted by Jacques Le Roux <jl...@apache.org>.
Thanks Dan for your diligence,

A cron job would be perfect. As I know your are busy and I have some spare time, in the meantime if you don't mind, I'll add your add your post at 
bottom of https://github.com/apache/ofbiz-tools/tree/master/demo-backup/ofbizdocker

Jacques

Le 18/07/2023 à 09:29, Daniel Watford a écrit :
> Hi Jacques and all,
>
> Following a request by Jacques to check on disk space used by Docker on our demo sites server (ofbiz-vm1) I thought I would post the steps followed 
> in case they were of interest to others.
>
> I opened a root terminal on ofbiz-vm1:
> > ssh danwatford@ofbiz-vm1.apache.org
> danwatford@ofbiz-vm1:~$ sudo bash
>
> I then open a byobu session so I can resume working in case of disconnection:
> root@ofbiz-vm1:/home/danwatford#byobu
>
> To check on disk space usage for the VM:
> root@ofbiz-vm1:/home/danwatford#df -h
> Filesystem Size  Used Avail Use% Mounted on
> /dev/root 97G   77G   21G  79% /
> devtmpfs  16G     0   16G   0% /dev
> tmpfs 16G   88K   16G   1% /dev/shm
> tmpfs  3.2G  1.6M  3.2G   1% /run
> tmpfs  5.0M     0  5.0M   0% /run/lock
> <snip>
>
> To check on disk space used by Docker:
> root@ofbiz-vm1:/home/danwatford# docker system df
> TYPE TOTAL     ACTIVE    SIZE RECLAIMABLE
> Images 106       6         49.22GB   47.17GB (95%)
> Containers 9         8         252.7kB   0B (0%)
> Local Volumes  23        23        705.7MB   0B (0%)
> Build Cache  0         0         0B        0B
>
> To clean up unused images and containers:
> root@ofbiz-vm1:/home/danwatford# docker system prune
> WARNING! This will remove:
>   - all stopped containers
>   - all networks not used by at least one container
>   - all dangling images
>   - all dangling build cache
>
> Are you sure you want to continue? [y/N] y
> Deleted Containers:
> aef9a0a458fa7ef3b7cb768def27a62396fd63b12471f30288e56c6cce473078
>
>
> Deleted Images:
> untagged: ghcr.io/apache/ofbiz@sha256:50c7888fadfec413d34a85cf327c5843b63002d4fc27b78f25b515650dfe750c 
> <http://ghcr.io/apache/ofbiz@sha256:50c7888fadfec413d34a85cf327c5843b63002d4fc27b78f25b515650dfe750c>
> deleted: sha256:34fbbf005c3d52d7320018de3031b5b1fdb8b32aa1a380457f3e0703987cd04b
> deleted: sha256:b2a89e9375e86a94295e15aa531a4f49261d8ea993d402474b8d49f2463858d6
> <snip>
> deleted: sha256:e6955d763fa7998204538aab84191f6540e3b5d00dfd674f42a3ae45235bff6a
> deleted: sha256:681f455f3bbb6d3076958b3696f0334c3121d35be69c350ebb3447c3af638761
>
> Total reclaimed space: 46.36GB
>
> The above command cleaned up 46 GB, mostly from unused cached container images.
>
> We can confirm that disk space has been reclaimed by checking df again:
> root@ofbiz-vm1:/home/danwatford# df -h
> Filesystem Size  Used Avail Use% Mounted on
> /dev/root 97G   30G   68G  31% /
>
> So available disk space increased from 21 GB to 68 GB due to the docker clean up process.
>
> We should install a cron job to run the clean up automatically.
>
> Dan.
>
> -- 
> Daniel Watford