1

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.

PYA
  • 8,096
  • 3
  • 21
  • 38
  • Try reading this question to see if it helps you https://stackoverflow.com/questions/30604846/docker-error-no-space-left-on-device – Daniel Jul 13 '17 at 20:27
  • @Daniel thats where i got the recommendation to delete the volumes and exited containers but no luck :( – PYA Jul 13 '17 at 20:28
  • Have you checked the /tmp free space and free memory ? I have seen situations where those were full and this ended in a misguiding error message like that you describe. You might want to pipe the output into gzip or netcat it to a server with more free space – Marged Jul 13 '17 at 20:42
  • @Marged `df /tmp` `Filesystem 1K-blocks Used Available Use% Mounted on` `/dev/mapper/centos-root 50808832 48607856 2200976 96% /` – PYA Jul 13 '17 at 20:52
  • @Marged so looks like there isnt enough in there, what are my options? one suggestion was to create a temporary `/tmp` but idk if that is safe, I'm on the production server – PYA Jul 13 '17 at 20:56
  • 1
    Alternatively, gzip it on the fly: `docker save myimage:0.0.1-SNAPSHOT | gzip > img.tar.gz` – Robert Jul 13 '17 at 21:01

2 Answers2

4

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
Robert
  • 33,429
  • 8
  • 90
  • 94
1

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.

Marged
  • 10,577
  • 10
  • 57
  • 99