I want to delete a Docker daemon; because it take more space on my pc
I did insert a code to install php:5.3-apache
I used this command docker build -t my-php-app .
I get this error
Sending build context to Docker daemon 7.039GB
Error response from daemon: unexpected error reading Dockerfile: read /var/lib/docker/tmp/docker-builder079515785/dockerfile: is a directory
so I want to delete that daemon because It take big space on my pc; I did tried 3 times to install it and every-time I get the same error so I have now more than 21GB that I want to clean.
docker images give me :
orsolin/docker-php-5.3-apache latest d8e72369c6e9 2 years ago 533MB
but space on my computer has been decreased from 30GB to 8GB
I don’t see anything with 7GB of size
REPOSITORY TAG IMAGE ID CREATED SIZE
abv_web latest 2194cdd678e3 45 hours ago 5.09GB
<none> <none> 58b330f4aa2f 46 hours ago 623MB
<none> <none> c4b5c889111d 46 hours ago 623MB
<none> <none> cfe4161b5af4 46 hours ago 623MB
<none> <none> f37f2a95529a 46 hours ago 623MB
httpd latest 19459a872194 4 days ago 154MB
phpmyadmin/phpmyadmin latest d8d2c1fd1eb9 9 days ago 458MB
phpmyadmin/phpmyadmin edge 4b557b055a8c 9 days ago 458MB
pweb_joomla latest 22c6d70d575e 10 days ago 1.01GB
fweb_joomla latest 0e36548560af 11 days ago 2.47GB
joomla apache 73acf8852f1b 13 days ago 461MB
mysql 5.6 732765f8c7d2 4 weeks ago 257MB
joomla 3.9.5-apache 398227376f4a 4 months ago 415MB
alterway/php 5.3-apache 87058120bc90 8 months ago 623MB
orsolin/docker-php-5.3-apache latest d8e72369c6e9 2 years ago 533MB
airinuit_mysql latest fa73519d1891 2 years ago 304MB
vsamov/mysql-5.1.73 latest fa73519d1891 2 years ago 304MB
2
Answers
You don’t want to delete the daemon, the daemon is actually the piece of software running on your host machine that able you to run docker commands.
If you want to remove existing images, volumes, containers, networks, build caches, you can dig into the command
Be careful with it, it will delete a lot things that you possibly still might use.
If you want to identify what does takes space in your host, prior to rennung any clean up, you can also run
Documentation about it: https://docs.docker.com/engine/reference/commandline/system_df/
That could reclaim lots of space on your host machine, and will even give you a sum up of the amount of space it reclaims:
The most radical form of it being:
Documentation could be found here: https://docs.docker.com/engine/reference/commandline/system_prune/
Docker internally runs on a client/server architecture. In particular, when you run
docker build
, it creates a tar file of the directory you specify, sends that tar file across a socket to the Docker daemon, and unpacks it there. (True even on a totally local system.)If something goes wrong, that content can back up in
/var/lib/docker/tmp
. Usually you shouldn’t be poking around in/var/lib/docker
at all, but cleaning out this directory should be safe. Consider stopping the daemon while you do it. Stopping the daemon, deleting all of/var/lib/docker
, and restarting the daemon should also help (you will need to re-docker build
and/ordocker pull
images and re-run containers, and this will lose anything in named volumes you haven’t backed up).The 7.039 GB build context is very large. In addition to problems like this it will just result in the
docker build
step being very slow; if all of that content getsCOPY
Ed into the image you will probably hit similar problems trying todocker push
the built image. You can try cleaning up things like log files or heap dumps if those are left lying around; adding things like your.git
directory or a local vendor tree to a.dockerignore
file can also help reduce the size of the context.