When I try to start a Postgres container on the default
machine on OS X, I get this error:
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
creating template1 database in /var/lib/postgresql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
FATAL: could not write to file "base/12141/12065": No space left on device
STATEMENT: CREATE DATABASE postgres;
child process exited with exit code 1
initdb: removing contents of data directory "/var/lib/postgresql/data"
copying template1 to postgres ...
When I ssh
into the machine using docker-machine ssh default
and run df -h
, I get this output:
tmpfs 1.8G 112.4M 1.7G 6% /
tmpfs 1001.4M 184.0K 1001.2M 0% /dev/shm
/dev/sda1 18.2G 17.2G 31.9M 100% /mnt/sda1
cgroup 1001.4M 0 1001.4M 0% /sys/fs/cgroup
none 237.3G 225.5G 11.9G 95% /Users
/dev/sda1 18.2G 17.2G 31.9M 100% /mnt/sda1/var/lib/docker/aufs
none 18.2G 17.2G 31.9M 100% /mnt/sda1/var/lib/docker/aufs/mnt/e0289dcde7fa0113481a65379aca4d1a2455d1724164f7cd0aedc5a0222c226d
none 18.2G 17.2G 31.9M 100% /mnt/sda1/var/lib/docker/aufs/mnt/1ad325fa03f9fac1b0a7134c19775aa61a0b971c227420fdecb14d19f8d067b8
Beside recreating the machine: What's the best way to get more space or clean up things?
After rm
-ing all containers and rmi
-ing all images, df -h
result looks like this:
Filesystem Size Used Available Use% Mounted on
tmpfs 1.8G 112.4M 1.7G 6% /
tmpfs 1001.4M 0 1001.4M 0% /dev/shm
/dev/sda1 18.2G 15.7G 1.5G 91% /mnt/sda1
cgroup 1001.4M 0 1001.4M 0% /sys/fs/cgroup
none 237.3G 226.0G 11.3G 95% /Users
/dev/sda1 18.2G 15.7G 1.5G 91% /mnt/sda1/var/lib/docker/aufs
As soon as I pull images for Node.js and Postgres again, available space is almost gone again...
Maybe you still have some volumes mounted in your machine.
I suggest to run this container to cleanup the whole thing:
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro -v /var/lib/docker:/var/lib/docker martin/docker-cleanup-volumes
Here for more informations and precautions: https://github.com/chadoe/docker-cleanup-volumes
Be aware that this will delete all your orphaned volumes data.
@Oliboy50 Thanks, this did the trick :+1:
filesystem Size Used Available Use% Mounted on
tmpfs 1.8G 112.4M 1.7G 6% /
tmpfs 1001.4M 0 1001.4M 0% /dev/shm
/dev/sda1 18.2G 77.3M 17.1G 0% /mnt/sda1
cgroup 1001.4M 0 1001.4M 0% /sys/fs/cgroup
none 237.3G 226.2G 11.1G 95% /Users
/dev/sda1 18.2G 77.3M 17.1G 0% /mnt/sda1/var/lib/docker/aufs
docker-cleanup-volumes didn't work on my docker-machine setup (OSX as well)
docker@default:~/docker-cleanup-volumes$ docker run --rm -v /var/run/docker.sock
:/var/run/docker.sock:ro -v /var/lib/docker:/var/lib/docker martin/docker-cleanu
p-volumes --dry-run
Delete unused volume directories from /var/lib/docker/volumes
In use 4423d5bdf1a2df1bd91083e0602f33271e30ff6b29cdb7297f94e95ce8e32c43
In use a4f95c3cd6a5b926b9dac6ff741ce35295771bc965c7f97dbedc6100838caa20
Directory /var/lib/docker/vfs/dir does not exist or is empty, skipping.
Due to Directory /var/lib/docker/vfs/dir does not exist or is empty, skipping.
@rodowi it worked on mine!
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro -v /var/lib/docker:/var/lib/docker martin/docker-cleanup-volumes
@kurenn When I run, give no space left on device
again: 馃槩
Unable to find image 'martin/docker-cleanup-volumes:latest' locally
latest: Pulling from martin/docker-cleanup-volumes
e6c44a677827: Downloading [> ] 26.06 kB/2.492 MB
e665190e5bfd: Downloading [==================================================>] 5.371 MB/5.371 MB
3f134245a2ac: Downloading [==================================================>] 2.033 kB/2.033 kB
docker: open /mnt/sda1/var/lib/docker/tmp/GetImageBlob736093559: no space left on device.
See 'docker run --help'.
@jklemm Check out this repo, it worked for me too https://github.com/chadoe/docker-cleanup-volumes
Let me know how it goes, please!
For those who (like myself) didn't have success with docker-cleanup-volumes on Mac OS X: you can use more "hardcore" way to cleanup everything.
Kill running containers:
docker kill $(docker ps -qa)
Delete them:
docker rm -v $(docker ps -qa)
Remove all images (I optionally used -f option to force delete all):
docker rmi -f $(docker images -q)
Hope this helps
@yaronius It worked for me :)
docker system prune -a -f --volumes.. post this command I was able to work.
@BensamV you're right
docker system prune -a --volumes
is now the recommended way if you really want to clean up everything
(unlike you, I prefer to remove the -f
option because it can lead to a "oops... I didn't want to... oh crap 馃槶")
Most helpful comment
Maybe you still have some volumes mounted in your machine.
I suggest to run this container to cleanup the whole thing:
Here for more informations and precautions: https://github.com/chadoe/docker-cleanup-volumes
Be aware that this will delete all your orphaned volumes data.