4
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
Pang
  • 9,564
  • 146
  • 81
  • 122
Gibbs
  • 21,904
  • 13
  • 74
  • 138
  • Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User - http://superuser.com. – frasnian Jan 22 '15 at 09:25
  • Is it possible for me to migrate it to superuser.com? – Gibbs Jan 22 '15 at 09:29
  • 1
    What is the size of your various images ? Can you post `docker images` – user2915097 Jan 22 '15 at 09:29
  • @GopsAB: I think so, but I've no clue how to migrate a question as I'm only active on SO. – frasnian Jan 22 '15 at 09:30
  • Avg size of each image is 900MB, i have more than 80 images. i don't need them all. – Gibbs Jan 22 '15 at 09:30
  • Usually an image is less than 300 MB, can you post a `docker history` about one, or show the Dockerfile associated ? – user2915097 Jan 22 '15 at 09:31
  • @GopsAB: this might help: http://meta.stackexchange.com/questions/91381/how-to-migrate-question-to-programmers-stackexchange-com - it's about PSE, but is probably equally applicable to SU. – frasnian Jan 22 '15 at 09:31
  • @user2915097 each image is based on ubuntu/centos. that's why it is too large. please wait for few sec. i 'll post history – Gibbs Jan 22 '15 at 09:33
  • ALL OF THE IMAGES ARE WITH NONE tag except few which are all i want – Gibbs Jan 22 '15 at 09:36
  • looks like they all have the same size (at 0,1 Mb), do you really need all of them ? How are they different ? – user2915097 Jan 22 '15 at 09:40
  • I don't need them all. they are all too old – Gibbs Jan 22 '15 at 09:43
  • @frasnian isn't Docker a tool used for programming? – Adrian Mouat Jan 22 '15 at 09:52
  • @AdrianMouat: it can be, but it's used for more than that. Since this seemed to be more of an administration issue I didn't think it was necessarily programming-related, any more than if was a question about the best way to use Docker to ship applications. It might be good for OP to ask this particular question on SU, SF, *and* SO anyway (assuming SU and SF have docker communities - I don't really frequent them so I don't know). – frasnian Jan 22 '15 at 10:03
  • @frasnian I suppose the main issue is SU has 49 Docker questions, SF has 211 and SO has 2549. So if I had a docker question, I would go here and risk the wrath of admins. It's difficult with a devops tool like this that clearly straddles disciplines. – Adrian Mouat Jan 22 '15 at 10:23
  • @AdrianMouat: wow, that is quite a disparity. I agree with you - if I had a docker question, I'd probably ask it here too. – frasnian Jan 22 '15 at 10:31

4 Answers4

7

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.

Adrian Mouat
  • 44,585
  • 16
  • 110
  • 102
  • Great. I have come across this somewhere. good for 'dangling=true'. But unfortunately, its not deleting. I executed the same. – Gibbs Jan 22 '15 at 09:52
3

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>
cutteeth
  • 2,148
  • 3
  • 25
  • 45
2

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
Community
  • 1
  • 1
cutteeth
  • 2,148
  • 3
  • 25
  • 45
  • I hope [this](http://stackoverflow.com/questions/21398087/how-to-delete-dockers-images) is the correct answer. i 'll try it – Gibbs Jan 22 '15 at 09:42
1

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)
gurubelli
  • 1,309
  • 2
  • 8
  • 12
  • Can you tell, how this is connected with @Adrian-mouat's answer? One mentions images, the other volumes. – akauppi Dec 06 '18 at 19:05