Hai impostato shm_size
in build
, questo influirà solo sulla build, devi impostarlo nel livello di servizio, come il prossimo:
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
File Docker:
FROM postgres:10
RUN df -h | grep shm
Quindi, docker-compose up -d --build
per avviarlo e controllare:
[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
Puoi vedere in fase di costruzione che mostra 256m
, ma il contenitore di runtime mostra 512m
.