diff --git a/postgres/content.md b/postgres/content.md index 0f98b18ed..ee35db720 100644 --- a/postgres/content.md +++ b/postgres/content.md @@ -243,7 +243,7 @@ The three easiest ways to get around this: If there is no database when `postgres` starts in a container, then `postgres` will create the default database for you. While this is the expected behavior of `postgres`, this means that it will not accept incoming connections during that time. This may cause issues when using automation tools, such as `docker-compose`, that start several containers simultaneously. -Also note that the default `/dev/shm` size for containers is 64MB. If the shared memory is exhausted you will encounter `ERROR: could not resize shared memory segment . . . : No space left on device`. You will want to pass [`--shm-size=256MB`](https://docs.docker.com/engine/reference/run/#runtime-constraints-on-resources) for example to `docker run`, or alternatively in [`docker-compose`](https://docs.docker.com/compose/compose-file/#shm_size). +Also note that the default `/dev/shm` size for containers is 64MB. If the shared memory is exhausted you will encounter `ERROR: could not resize shared memory segment . . . : No space left on device`. You will want to pass [`--shm-size=256MB`](https://docs.docker.com/engine/reference/run/#runtime-constraints-on-resources) for example to `docker run`, or alternatively in [`docker-compose`](https://docs.docker.com/compose/compose-file/05-services/#shm_size). ## Where to Store Data diff --git a/postgres/stack.yml b/postgres/stack.yml index 3994b0c47..94f8c78c1 100644 --- a/postgres/stack.yml +++ b/postgres/stack.yml @@ -1,11 +1,19 @@ # Use postgres/example user/password credentials -version: '3.1' +version: '3.9' services: db: image: postgres restart: always + # set shared memory limit when using docker-compose + shm_size: 128mb + # or set shared memory limit when deploy via swarm stack + #volumes: + # - type: tmpfs + # target: /dev/shm + # tmpfs: + # size: 134217728 # 128*2^20 bytes = 128Mb environment: POSTGRES_PASSWORD: example