I want to resize postgres
container's shared memory from default 64M
. So I add:
build:
context: .
shm_size: '2gb'
I'm using version 3.6 of the compose file, postgres
service definition.
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: '2gb'
However, this change doesn't take effect even though I restart the service docker-compose down
then up
. So Immediately I start interacting with postgres to display some data on dashboard, I get shared memory issue.
Before lunching the dashboard:
$docker exec -it fiware-postgres df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/docker-253:1-107615-1541c55e4c3d5e03a7716d5418eea4c520b6556a6fd179c6ab769afd0ce64d9f 10G 266M 9.8G 3% /
tmpfs 64M 0 64M 0% /dev
tmpfs 1.4G 0 1.4G 0% /sys/fs/cgroup
/dev/vda1 197G 52G 136G 28% /etc/hosts
shm 64M 8.0K 64M 1% /dev/shm
tmpfs 1.4G 0 1.4G 0% /proc/acpi
tmpfs 1.4G 0 1.4G 0% /proc/scsi
tmpfs 1.4G 0 1.4G 0% /sys/firmware
After lunching the dashboard:
$docker exec -it fiware-postgres df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/docker-253:1-107615-1541c55e4c3d5e03a7716d5418eea4c520b6556a6fd179c6ab769afd0ce64d9f 10G 266M 9.8G 3% /
tmpfs 64M 0 64M 0% /dev
tmpfs 1.4G 0 1.4G 0% /sys/fs/cgroup
/dev/vda1 197G 52G 136G 28% /etc/hosts
shm 64M 50M 15M 78% /dev/shm
tmpfs 1.4G 0 1.4G 0% /proc/acpi
tmpfs 1.4G 0 1.4G 0% /proc/scsi
tmpfs 1.4G 0 1.4G 0% /sys/firmware
postgres error log:
2019-07-01 17:27:58.802 UTC [47] ERROR: could not resize shared memory segment "/PostgreSQL.1145887853" to 12615680 bytes: No space left on device
What's going on here?