Je stelt shm_size
in in build
, dit heeft alleen invloed op de build, je moet het in serviceniveau instellen, zoals het volgende:
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
Dockerbestand:
FROM postgres:10
RUN df -h | grep shm
Vervolgens docker-compose up -d --build
om het te starten en te controleren:
[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
U kunt zien dat in de bouwtijd 256m
. wordt weergegeven , maar de runtime-container toont 512m
.