I am using docker on windows. I installed docker following this link https://docs.docker.com/toolbox/toolbox_install_windows/. Then I built the image from https://github.com/floydhub/dl-docker
Now I want to save the image to my pc. This was the command I issued.
docker save -o c:/Users/Student/dl-docker-latest.tar 69b639351d9c
Then I got this error
Error response from daemon: write /mnt/sda1/var/lib/docker/tmp/docker-export-757581070/3cb616a54d6bdbb8bb42a53a62b44de10eb7d7ea63b4b0a5038493175e7e12b3/layer.tar: no space left on device
Can someone tell me what is going on ? I have more than enough space on my pc and the image is only 8GB.
How do I get to this location from my terminal ?
/mnt/sda1/var/lib/docker/tmp/docker-export-757581070/3cb616a54d6bdbb8bb42a53a62b44de10eb7d7ea63b4b0a5038493175e7e12b3
I followed http://phutchins.com/blog/2017/01/04/fixing-docker-no-space-left-on-device/ and typed docker run --rm --privileged floydhub/dl-docker:cpu df -h
I guess I need to increase the size of docker
The problem is that docker daemon uses its own way for export, import and build. So it may create a copy of the image temporarily. Which means if it s a 8GB image you may need additional space for the operation to work.
Docker for windows uses Hyper-V to create a Linux VM and runs docker inside it. There is default space allocated to it, so even though your laptop has space left the VM doesn't have.
So what's the solution.
Try STDOUT instead of file
docker save 69b639351d9c > c:/Users/Student/dl-docker-latest.tar
I have my doubts this would work, but worth a try
Increase the VM Size
Now I don't know if there a easier way for this. But you need to create the VM again with a bigger size
See the below issue for more details
https://github.com/docker/kitematic/issues/825
Or you can try resizing the existing disk using techniques mentioned in below article
http://derekmolloy.ie/resize-a-virtualbox-disk/
Related
My problem:
I'm trying to save a Jetson TX2 docker image that's about 8GB. The OS and other files+OS are taking up around 21GB meaning I only have about 3GB of storage on the machine. I have already pruned old images and containers, and cannot delete or free up any more space. Because of this I've tried saving the docker image to an USB stick.
However, when I try to build the docker file I get the error:
*Error response from daemon: write /var/lib/docker/tmp/docker-export-50xxxxx/layer.tar: no space left on device*
Even though I am trying to save the docker image to an USB with enough space, Docker seems to build the whole file first using the /var/lib/docker/tmp/ folder and then wants to move it to the USB. However there simply isn't enough space on the device. Because of this I keep getting the error listed above.
My question:
Is there any way to save a docker image without using my main drive as intermediary storage? I can ssh into the Jetson and have an USB/SD card with sufficient capacity. If there is another solution that would solve my problem that would be great to hear too.
Mount the USB drive on the system and then use the -o flag of docker export to export the image.
So with an example USB drive mounted on /mnt/usb, use ....
docker export -o /mnt/usb <CONTAINER ID>
Background:
I run a java process in my docker container and I take histo dumps using jmap to a file at /home/heapdump.txt inside container. I get this file from the container for further processing.
Now, I do this at an interval of 5 minutes. However, after 20 mins meaning, 4 heapdumps, when I try to get this file, I get the below error:
{"message":"mount/:/var/lib/docker/overlay2/<container_id>/merged/hostroot, flags: 0x5001: no space left on device"}
I don't understand what no space left on device means in this case. ๐๐๐
Your storage is mapped to default /var. Which I believe will hold much less space unless you have manually allotted more.
Do a df -kh on your device and see the status of the device mapped to /var. You would have run out of space.
To fix this find a disk with good space - remember this will be used by docker to store all its image and volume data. and make the docker use it.
You need to configure this in daemon.json file as a data-root config like below.
{
โdata-rootโ: โ/new/data/root/pathโ
}
Remember to reload the daemon and restart docker service.
Once done you will see docker beautifully copies its image and volume data to the new directory.
once you test you can clean up the var/lib/docker.
Hope this helps
When I am trying to build the docker image I am getting out of disk space error and after investigating I find the following:
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 4G 3.8G 0 100% /
How do I fix this out of space error?
docker system prune
https://docs.docker.com/engine/reference/commandline/system_prune/
This will clean up all images, containers, networks, volumes not used. We generally try to clean up old images when creating a new one but you could also have this run as a scheduled task on your docker server every day.
use command - docker system prune -a
This will clean up total Reclaimable Size for Images, Network & Volume..... This will remove all images related reclaimable space which are not associated with any running container.....
Run docker system df command to view Reclaimable memory
In case there is some Reclaimable memory then if above command does not work in first go then run the same command twice then it should cleaned up....
I have been experiencing this behavior almost on daily basis.....
Planning to report this bug to Docker Community but before that want to reproduce this bug with new release to see if this has been fixed or not with latest one....
Open up the docker settings -> Resources -> Advanced and up the amount of Hard Drive space it can use under disk image size.
If you are using linux, then most probably docker is filling up the directory /var/lib/docker/containers, because it is writing container logs to <CONTAINER_ID>-json.log file under this directory. You can use the command cat /dev/null > <CONTAINER_ID>-json.log to clear this file or you can set the maximum log file size be editing /etc/sysconfig/docker. More information can be found in this RedHat documentation. In my case, I have created a crontab to clear the contents of the file every day at midnight. Hope this helps!
NB:
You can find the docker containers with ID using the following command
sudo docker ps --no-trunc
You can check the size of the file using the command
du -sh $(docker inspect --format='{{.LogPath}}' CONTAINER_ID_FOUND_IN_LAST_STEP)
Nothing works for me. I change the disk images max size in Docker Settings, and just after that it free huge size.
Going to leave this here since I couldn't find the answer.
Go to the Docker GUI -> Prefereces -> Reset -> Uninstall
Completely uninstall Docker.
Then install it fresh using this link
My docker was using 20GB of space when building an image, after fresh install, it uses 3-4GB max. Definitely helps!
Also, if you using a macbook, have look at ~/Library/Containers/docker*
This folder for me was 60 GB and was eating up all the space on my mac! Even though this may not be relevant to the question, I believe it is vital for me to leave this here.
I am on docker version 1.11.2. I am trying to docker save an image but i get
an error.
i did docker images to see the size of the image and the result is this
myimage 0.0.1-SNAPSHOT e0f04657b1e9 10 months ago 1.373 GB
The server I am on is low on space but it has 2.2 GB available but when I run docker save myimage:0.0.1-SNAPSHOT > img.tar i get
write /dev/stdout: no space left on device
I removed all exited containers and dangling volumes in hopes of making it work but nothing helped.
You have no enough space left on device. So free some more space or try gzip on the fly:
docker save myimage:0.0.1-SNAPSHOT | gzip > img.tar.gz
To restore it, docker automatically realizes that is gziped:
docker load < img.tar.gz
In such a situation where you can't free enough space locally you might want to use storage available over a network connection. A little bit more difficult to set up are NFS or Samba.
The easiest approach could be piping the output through netcat, but keep in mind that this is at least by default unencrypted.
But as long as your production server is that low on space you are vulnerable to a bunch of other problems.
Until you can provide more free space I wouldn't create files locally, zipped or not. You could bring important services down when you run out of free space.
I am on OS X.
I have been using kitematic for some time now, but today I wanted to switch to boot2docker, as I sometimes find kitematic very abstract to the user.
The problem I am facing is, is there a way to use all the images that I built in kitematic, in boot2docker. It took me considerable time to build 2 of them, and I certainly don't want to build them again.
I think one way would be to first push the image to docker hub using kitematic, and then pull it in boot2docker. But, that would consume a lot of data, as the image is pretty large.
The images are right now stored somewhere on my mac, so there must be some way to directly use them in boot2docker, right?
Use docker save to save the image to a tar file and docker load to load it back in your other vm.
You can also try docker-machine. Then use docker-machine env dev | source to access your docker images via the docker CLI.