Reputation: 1309
postgres:9.5
I try rebooting,
docker-compose build --no-cache
delete image and container and build again
I have many proyects and anybody starts, keeps the same configuration... Mac osx Sierra
Apparently the containers were not deleted well, I tried with this and after rebuild works ok.
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
docker-compose.yml
version: '2'
services:
web:
build: .
image: imagename
command: python manage.py runserver 0.0.0.0:8000
ports:
- "3000:3000"
- "8000:8000"
volumes:
- .:/code
depends_on:
- migration
- redis
- db
redis:
image: redis:3.2.3
db:
image: postgres:9.5
volumes:
- .:/tmp/data/
npm:
image: imagename
command: npm install
volumes:
- .:/code
migration:
image: imagename
command: python manage.py migrate --noinput
volumes:
- .:/code
depends_on:
- db
Dockerfile:
FROM python:3.5.2
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD . /code/
RUN mkdir /code
WORKDIR /code
RUN easy_install -U pip
ADD requirements.txt /code/requirements.txt
RUN pip install -r requirements.txt`
Upvotes: 31
Views: 45410
Reputation: 2109
Surprisingly, no one here has told about docker system df -v
to see which image are using too much space. Then you known which ones you want to remove, you can do it using docker rmi <image>:<tag>
.
Reference in the docs, for Mac users :
Reference in the docs, for Linux users :
Upvotes: 1
Reputation: 1932
If you're facing issues about disk space from a single or multiple containers in your Docker for Mac development environment, there are two possible solutions you can consider.
Firstly, the issue may be related to the disk image size limitation of your local Docker installation. Cleaning up some unused images might solve the issue.
$ docker volume prune
This command frees up disk space by deleting volumes that are no longer in use.
If this approach didn't work, try changing the Docker for Mac - Disk image size settings.
Modifying the settings should be considered as a last resort if the volume pruning does not solve the problem. This approach ensures that you optimize the disk space efficiently without making unnecessary changes to Docker for Mac's configuration.
Upvotes: 4
Reputation: 759
I faced this problem on Docker Desktop for Mac, after I've rebuilt the containers and started these via docker compose up
. But the older versions of these containers were already running, because these were set to restart automatically.
I.e. the PostgreSQL DB couldn't set the lock on the named volume, because there was a concurrent access with the running container.
Upvotes: 0
Reputation: 188
Off late, I faced a similar issue with postgres and mysql databases. All of a sudden these containers exited without any external trigger. I spend much time on this issue finally it was identified as RAM allocation issue in the server.
There were 13 containers working in the same path out of which 3 postgres and 1 mysql database containers also present. These containers exited and the application stopped working. There were 2 errors in the docker logs - mainly
postgresql database directory appears to contain a database
and
FATAL: could not write lock file "postmaster.pid": No space left on device
I tried stopping all other services and starting the database containers only but this issue repeated
First of all check the storage utilisation status with the below command
df [OPTION]... [FILE]...
df -hP
In my case, it was showing 98% utilised and databases were not able to add new records which caused the problem. After allocated additional memory to the NFS mount, the issue cleared
Once it is done, verify the RAM utilisation status also which will be increased now
free -h
This will return values in total, used, free, shared, buff/cache, available. If you try stopping containers one by one and restarting, you can see these are consuming memory from the shared category. So in my case, there was almost 18M showing initially in shared which was not enough for the databases to run along with all other containers. After the NFS mount is increased, the shared RAM also increased to 50M which means all services working fine
So it is pure physical storage space issue and you should act proactively to remove old unused files, docker images which takes huge space, local docker volumes etc. Check in docker documentation to perform these steps
https://docs.docker.com/config/pruning/
Upvotes: 1
Reputation: 4973
My case, goto docker Dashboard -> Settings and increate Disk Image size
then restart
Upvotes: 25
Reputation: 1408
If you're coming here from Google and finding that multiple containers are complaining of Disk space, the issue may be that your local Docker installation has maxed out its disk image size. This is configurable in Docker for Mac. Here are the instructions to change that disk image size.
Upvotes: 30
Reputation: 1312
If you do not have any critical data you can blow away the docker volume.
docker volume ls
docker volume rm your_volume
Upvotes: 19