Docker :无法写入锁定文件“postmaster.pid“:设备上没有剩余空间

dkqlctbz  于 2022-12-11  发布在  Docker
关注(0)|答案(6)|浏览(436)

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`
zfycwa2u

zfycwa2u1#

如果您没有任何关键数据,您可以吹走docker卷。
docker volume ls
docker volume rm your_volume

ldioqlga

ldioqlga2#

如果您从Google转到此处,发现多个container都在抱怨磁盘空间不足,问题可能是您的本地Docker安装已超出其磁盘映像大小的上限。这可以在Docker for Mac. Here are the instructions to change that disk image size中配置。

mwyxok5s

mwyxok5s3#

您可以执行docker volume prune来删除所有未使用的本地卷。

ghg1uchk

ghg1uchk4#

我的案例,后藤Docker Jmeter 盘-〉设置并增加Disk Image size,然后重新启动

dldeef67

dldeef675#

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/

m4pnthwp

m4pnthwp6#

我在Docker Desktop for Mac上遇到了这个问题,在我重建了容器并通过docker compose up启动这些容器之后。但是这些容器的旧版本已经在运行,因为它们被设置为自动重启。
例如,PostgreSQL DB无法在指定卷上设置锁,因为存在与正在运行的容器的并发访问。

相关问题