Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker-compose INTERNAL ERROR: cannot create temporary directory

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?

like image 429
RK3 Avatar asked Nov 23 '16 03:11

RK3


3 Answers

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

like image 134
Popeye Avatar answered Oct 31 '22 09:10

Popeye


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!

like image 35
Paul Rock Avatar answered Oct 31 '22 07:10

Paul Rock


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.

like image 2
Captain Kenpachi Avatar answered Oct 31 '22 07:10

Captain Kenpachi