My main problem started first when I tried to deploy my docker image to gcp and received the error No Space Left On Device. After looking a while I found out that I had to delete the /var/lib/docker and pull the image again.
sudo umount /var/lib/docker/
sudo systemctl stop docker
sudo umount /var/lib/docker/
sudo rm -rf /var/lib/docker/
sudo systemctl restart docker
docker pull myImage
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v "$PWD:/rootfs/$PWD" -w="/rootfs/$PWD" docker/compose:1.26.0 up -d
When I want to get rid of the previous images/containers etc I run docker system prune -a but nothing seems to get pruned. And whenever I want to deploy another image same problem repeats.
As a result of this I have two terrible problems which become even worse for the last 3 days.
- Server become incredibly slow I am getting 502 Bad Gateaway (nginx, I am assuming server stopped responding). I am getting this message which asks me to increase the performance This instance has had high memory utilization recently. Consider switching to the machine type: custom (1 vCPU, 6.25 GB memory)
- Server costs increased a lot. First whenever I deployed a new image I was charged with 20-30 euros of GCP Storage egress between NA and EU which kept increasing. And for the last 3 days I am still charged for this even when I don't deploy anything. To give a comparison my estimated server total costs for a month increased from 150 euros to 925 euros.
I also tried to look at the inode usage before but I couldn't find the problem.
My docker images in total are around 400 MB. So it shouldn't make the disk full. My machine type is custom (1 vCPU, 4.75 GB memory)** and it has a 10 GB standard persistent disk
How can I fix these issues? I am especially concerned with the first question, but I think the answer to first question should help with second question as well.
Note: My VM is in Germany hence the cost for pulling the image from gcr.io (It pulls it from NA. I don't know how to pull it from Germany)