sql >> Database teknologi >  >> RDS >> PostgreSQL

docker SHM_SIZE /dev/shm:ændre størrelse på delt hukommelse

Du indstiller shm_size i build , dette vil bare påvirke build, du skal indstille det i serviceniveau, som næste:

docker-compose.yaml:

version: "3.6"

services:

 #other services go here..
 postgres:
    restart: always
    image: postgres:10
    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
    build:
      context: .
      shm_size: 256mb
    shm_size: 512mb

Dockerfil:

FROM postgres:10

RUN df -h | grep shm

Derefter docker-compose up -d --build for at starte den og kontrollere:

[email protected]:~/66$ docker-compose --version
docker-compose version 1.24.0, build 0aa59064
[email protected]:~/66$ docker-compose up -d --build
Building postgres
Step 1/2 : FROM postgres:10
 ---> 0959974989f8
Step 2/2 : RUN df -h | grep shm
 ---> Running in 25d341cfde9c
shm             256M     0  256M   0% /dev/shm
Removing intermediate container 25d341cfde9c
 ---> 1637f1afcb81

Successfully built 1637f1afcb81
Successfully tagged postgres:10
Recreating fiware-postgres ... done
[email protected]:~/66$ docker exec -it fiware-postgres df -h | grep shm
shm             512M  8.0K  512M   1% /dev/shm

Du kan se i byggetid, at den viser 256m , men runtime-beholderen viser 512m .



  1. PHP konverter fra MySql til Excel Regneark Autosize kolonner

  2. PHP/Smarty Nested array fra DB

  3. Vis data med format i Datagridview

  4. Oracle 2 bindestreger i talkolonnen?