docker-postgre

花生与酒發表於2024-07-09

經常出現no space left等問題

53100: could not resize shared memory segment "/PostgreSQL.3788042838" to 2097152 bytes: No space left on device

要增加shm_size

version:"3.5"
services:

#other containers GO here..

 postgres:
    restart: always
    image: postgres:10

    #THIS MUST BE ADDED AT SERVICE LEVEL
    shm_size: 1gb

    hostname: postgres
    container_name: fiware-postgres
    expose:
      -"5432"
    ports:
      -"5432:5432"
    networks:
      - DEFAULT
    environment:
      -"POSTGRES_PASSWORD=password"
      -"POSTGRES_USER=postgres"
      -"POSTGRES_DB=postgres"
    volumes:
      - ./postgres-DATA:/var/lib/postgresql/DATA

最後執行 docker-compose up -d