Am trying to use docker-compose command and bring up container. But am facing error INTERNAL ERROR: cannot create temporary directory!. Am not able to pull, stop, rm or UP and container. Can anyone suggest how to resolve this?
I was suffering from the same issue. It turned out that I'd ran out of Disk Space.
All I needed to do was clear down the old containers and images by running the below commands. I ran these on my Docker directory and everything was good afterwards.
Remove Containers Command:
#!/bin/bash
# Remove all stopped containers
docker rm $(docker ps -a -q)
# Remove all containers
docker rm -f $(docker ps -a -q)
Command options:
--force
or -f
: Force the removal of running container (uses SIGKILL
).
--volumes
or -v
: Remove the Volumes associated with the container.
--link
or -l
: Remove the specified link.
Remove Images Command:
# Delete all images
docker rmi $(docker images -q)
Command options:
--force
or -f
: Force removal of the image.
--no-prune
: Do not delete untagged parents.
System Prune Command: -- Suggested by Ryan Allan
in comments.
#!/bin/bash
#System Prune
docker system prune
--all
or -a
: Remove all unused images not just dangling ones.
--filter
Provide filter values (e.g. 'label==') <-- From API 1.28+
--force
or -f
: Do not prompt for confirmation.
--volumes
: Prune volumes.
Base Command:
docker
: The base command for Docker CLI.
Code referenced from Docker remove all images and containers
You have run out of space on the disk where the Docker cache is located, you can verify this by running the command df -h
. To fix this you need to clean disk space, for example you can clean the Docker cache, look at small script below.
This solution is based on Popeye
answer, but with force stopping of all images:
#!/bin/bash
# Force stop all containers
docker kill $(docker ps -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
But as Ryan Allen
told, better to use the docker system prune
for removing of all containers, images and networks. So the final view of script should be:
#!/bin/bash
# Force stop all containers
docker kill `docker ps -q`
# Delete all containers, images and networks
docker system prune
Enjoy!
For people using docker inside a VM, it might also be that you might have inadvertently disconnected the drive that the VM image is stored on. As was my case. In such an event, it is best to stop the VM, make sure the drive is attached, and then restarting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With