i run a linux sql server on my mac and it slowly eats all the space i gave it.
this is the second time this happened to me after already uninstalling and reinstalling my container.
when i go to container files they are all very small and i dont know whats taking up all this space.
i started with about 55 gb remaining and now i have 16gb after about a month of using it when yesterday i had 18gb remaining.
i suspect that the logs are taking up all the space so i tried looking up the issue and trying peopleās fixes to no successā¦
please help
update:
my docker.raw file is 40gb out of the 64gb i enabled for it.
40gb is still a lot based on the fact i only use sql for school work which isnāt a lot
how do i clear junk from the docker.raw file?
Containers are made for isolation and usually throw away. You should prepare accordingly and always persist relevant data.
Either use a volume, that can only be accessed from within containers, or use a bind mount (also using volume command option but with a local host path) to map a local host directory into the container. Usually the Docker images have a description how to handle this, especially the database ones.
Of course you can continuously manually truncate the log files, find the files and run truncate on them within the VM. Something like
As @bluepuma77 suggested multiple times in this topic, everything is in the virtual machine, so you will not find anyhing on your actual host. You can try this:
docker run --rm -it -v /:/host bash ls -la /host/var/lib/docker/containers
Or based on the last suggested command
You can try this to first check the log sizes
docker run --rm -it -v /:/host bash find /host/var/lib/docker/containers/ -type f -name "*-json.log" -exec ls -lh {} \;
So this is how you would truncate the log files:
docker run --rm -it -v /:/host bash find /host/var/lib/docker/containers/ -type f -name "*-json.log" -exec truncate -s 0 {} \;
In this case you will also truncate the log file of the container from which you are running the find command. I tried and worked without breaking Docker Desktop, but I never like messing with the docker data root unless it is really necessary.
In the long term, it is better to reconfigure the container with log limits
i just figured out the problem. every time the container fails to start it creates a 1gb .gdmp file and stores it in var/opt/mssql/log/core.sqlservr.12_18_2024_10_56_44.25.d and thats taking up all my space.
the thing is it creates a different folder every time it fails and stores a dump file there
for example i have:
var/opt/mssql/log/core.sqlservr.12_18_2024_10_56_44.25.d,
var/opt/mssql/log/core.sqlservr.12_18_2024_10_56_53.25.d
and so on.
is there any way to stop this?
If there is no answer to this problem, I would suggest raising an issue in https://github.com/microsoft/mssql-docker/issues, as others will high likely be affected as well, and a fix might benefit everyone
Update: I found this Issue and this issue which indicate the core dumps might be a silicon emulation bug. Apparently downgrading to Docker Desktop 4.32.0 is a viable workaround for time being.
I can imagine. Who would have thought thatās the cause of the problem is such a bag of surprises.
Still, it wouldnāt hurt to still raise an issue in the mssql server repo, and ask if they can implement at least an entry point script that makes sure that up to N core dumps are kept, or core dumps older than N weeks are deleted automatically. That should be a fairly low-hanging fruit.
Please let us know after testing, whether downgrading to 4.32.0 worked for you, so that others can benefit from your experience as well.
i am a beginner in docker and i donāt really understand it well so i have no idea what issue i should report or how to fix it
as for downgrading, iām sticking to the updated version of docker just because i donāt want anything to happen and iāll just delete the dump files manually until i find some way to do it automatically (because i have no idea how to code in terminal and all that)
but thank you very much for the quick answer and solution!