Gibbs
Gibbs

Reputation: 22956

Docker images eats up lots of space?

docker ps -aq

Shows only 7-9 images.

/var/lib/docker/graph

shows me n number of images.

When I create a file, I get write error due to system full error. I tried to create symbolic link. but I cannot able to move all the docker things.

Is it good to remove everything under /var/lib/docker/graph? What are the other possibilities than creating symbolic link and extending disk? I would prefer deleting unnecessary things.

<none>                 <none>              02a16288ef14        6 days ago          773.3 MB
<none>                 <none>              21a606deee7e        6 days ago          773.3 MB
<none>                 <none>              8a38f2888018        6 days ago          773.2 MB
<none>                 <none>              f41395b7637d        6 days ago          773.3 MB
<none>                 <none>              8b82d707167c        6 days ago          773.3 MB

Upvotes: 4

Views: 2665

Answers (4)

gurubelli
gurubelli

Reputation: 1329

I faced the similar issue running out of space. Then I realized that dangling docker volumes are eating up space.

You can delete the dangling docker volumes with the following command

  docker volume rm $(docker volume ls -qf dangling=true)

Upvotes: 1

cutteeth
cutteeth

Reputation: 2213

Use docker ps -a to get the container ID and image ID. You can remove the container with

 docker rm <containerID>

Then you can remove the image with

 docker rmi <imageID>

Upvotes: 3

Adrian Mouat
Adrian Mouat

Reputation: 46480

To get rid of "dangling" images, run the following:

$ docker rmi $(docker images -q -f dangling=true)

That should clear out all the images marked "none". Be aware however, that images will share base layers, so the total amount of diskspace used by Docker will be considerably less than what you get by adding up the sizes of all your images.

Upvotes: 7

cutteeth
cutteeth

Reputation: 2213

According to the answer given here,

  • /var/lib/docker/aufs/diff/ has the file contents of the images.
  • /var/lib/docker/graph/ now only contains metadata about the image, in the json and layersize files.
  • /var/lib/docker/repositories-aufs is a JSON file containing local image information. This can be viewed with the command docker images.

    Refer to this link, Docker containers can be stopped and deleted by the following commands

  • docker ps

  • docker stop
  • docker rm containerid
  • docker rmi imageid

Upvotes: 2

Related Questions