Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bx9jE-0000xB-J0 for pgsql-admin@arkaria.postgresql.org; Thu, 20 Oct 2016 09:33:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bx9jE-0001VF-5V for pgsql-admin@arkaria.postgresql.org; Thu, 20 Oct 2016 09:33:36 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bx9hV-000847-S2 for pgsql-admin@postgresql.org; Thu, 20 Oct 2016 09:31:50 +0000 Received: from host3.dynacom.ondsl.gr ([62.103.35.211] helo=smadev.internal.net) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bx9hO-0001SZ-BN for pgsql-admin@postgresql.org; Thu, 20 Oct 2016 09:31:48 +0000 Received: from smadev.internal.net (smadev [10.9.200.131]) by smadev.internal.net (8.15.2/8.15.2) with ESMTP id u9K9VbcP097427 for ; Thu, 20 Oct 2016 12:31:38 +0300 (EEST) (envelope-from achill@matrix.gatewaynet.com) Subject: Re: Docker with data inside To: pgsql-admin@postgresql.org References: From: Achilleas Mantzios Message-ID: <58088EF9.6000406@matrix.gatewaynet.com> Date: Thu, 20 Oct 2016 12:31:37 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------050109050808010609000909" X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org This is a multi-part message in MIME format. --------------050109050808010609000909 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Καλημέρα Δημήτρη On 20/10/2016 12:04, Κοκμάδης Δημήτριος wrote: > Hello, > > I am trying to create a docker Postgres container with database inside. > > When I try to run the container I have the following error > > 2016-10-20 08:58:33 UTC FATAL: the database system is starting up > 2016-10-20 08:58:33 UTC DEBUG: shmem_exit(1): 0 before_shmem_exit callbacks to make > 2016-10-20 08:58:33 UTC DEBUG: shmem_exit(1): 0 on_shmem_exit callbacks to make > 2016-10-20 08:58:33 UTC DEBUG: proc_exit(1): 1 callbacks to make > 2016-10-20 08:58:33 UTC DEBUG: exit(1) > In IPC-enabled/compiled versions you might want to set some kernel tunables related to IPC : sysctl -a | grep -e 'sem|shm' and adjust accordingly. It seems that your installation uses mmap so you gotta handle this error first : "mmap with MAP_HUGETLB failed, huge pages disabled: Cannot allocate memory" See some Docker info how to resolve this. > > The entry point is > > su -c "/usr/lib/postgresql/9.4/bin/postgres -d 3 -D /var/lib/postgresql/9.4/main -c config_file=/etc/postgresql/9.4/main/postgresql.conf" postgres > > and the output of command > > 2016-10-20 08:56:58 UTC DEBUG: postgres: PostmasterMain: initial environment dump: > 2016-10-20 08:56:58 UTC DEBUG: ----------------------------------------- > 2016-10-20 08:56:58 UTC DEBUG: HOSTNAME=c0e6a383b652 > 2016-10-20 08:56:58 UTC DEBUG: SHELL=/bin/bash > 2016-10-20 08:56:58 UTC DEBUG: TERM=xterm > 2016-10-20 08:56:58 UTC DEBUG: USER=postgres > 2016-10-20 08:56:58 UTC DEBUG: MAIL=/var/mail/postgres > 2016-10-20 08:56:58 UTC DEBUG: PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games > 2016-10-20 08:56:58 UTC DEBUG: _=/usr/lib/postgresql/9.4/bin/postgres > 2016-10-20 08:56:58 UTC DEBUG: PWD=/var/ansible > 2016-10-20 08:56:58 UTC DEBUG: LANG=en_US.UTF-8 > 2016-10-20 08:56:58 UTC DEBUG: HOME=/var/lib/postgresql > 2016-10-20 08:56:58 UTC DEBUG: SHLVL=2 > 2016-10-20 08:56:58 UTC DEBUG: LOGNAME=postgres > 2016-10-20 08:56:58 UTC DEBUG: PGLOCALEDIR=/usr/share/locale > 2016-10-20 08:56:58 UTC DEBUG: PGSYSCONFDIR=/etc/postgresql-common > 2016-10-20 08:56:58 UTC DEBUG: LC_COLLATE=en_US.UTF-8 > 2016-10-20 08:56:58 UTC DEBUG: LC_CTYPE=en_US.UTF-8 > 2016-10-20 08:56:58 UTC DEBUG: LC_MESSAGES=en_US.UTF-8 > 2016-10-20 08:56:58 UTC DEBUG: LC_MONETARY=C > 2016-10-20 08:56:58 UTC DEBUG: LC_NUMERIC=C > 2016-10-20 08:56:58 UTC DEBUG: LC_TIME=C > 2016-10-20 08:56:58 UTC DEBUG: ----------------------------------------- > 2016-10-20 08:56:58 UTC DEBUG: invoking IpcMemoryCreate(size=294363136) > 2016-10-20 08:56:58 UTC DEBUG: mmap with MAP_HUGETLB failed, huge pages disabled: Cannot allocate memory > 2016-10-20 08:56:58 UTC DEBUG: SlruScanDirectory invoking callback on pg_notify/0000 > 2016-10-20 08:56:58 UTC DEBUG: removing file "pg_notify/0000" > 2016-10-20 08:56:58 UTC DEBUG: dynamic shared memory system will support 108 segments > 2016-10-20 08:56:58 UTC DEBUG: created dynamic shared memory control segment 1804289383 (876 bytes) > 2016-10-20 08:56:58 UTC DEBUG: max_safe_fds = 984, usable_fds = 1000, already_open = 6 > 2016-10-20 08:56:58 UTC LOG: redirecting log output to logging collector process > 2016-10-20 08:56:58 UTC HINT: Future log output will appear in directory "/var/log/postgresql". > 2016-10-20 09:00:41 UTC DEBUG: logger shutting down > 2016-10-20 09:00:41 UTC DEBUG: shmem_exit(0): 0 before_shmem_exit callbacks to make > 2016-10-20 09:00:41 UTC DEBUG: shmem_exit(0): 0 on_shmem_exit callbacks to make > 2016-10-20 09:00:41 UTC DEBUG: proc_exit(0): 0 callbacks to make > 2016-10-20 09:00:41 UTC DEBUG: exit(0) > 2016-10-20 09:00:41 UTC DEBUG: shmem_exit(-1): 0 before_shmem_exit callbacks to make > 2016-10-20 09:00:41 UTC DEBUG: shmem_exit(-1): 0 on_shmem_exit callbacks to make > 2016-10-20 09:00:41 UTC DEBUG: proc_exit(-1): 0 callbacks to make > > > My configuration parameters are > > data_directory = '/var/lib/postgresql/9.4/main'# use data in another directory > hba_file = '/etc/postgresql/9.4/main/pg_hba.conf'# host-based authentication file > ident_file = '/etc/postgresql/9.4/main/pg_ident.conf'# ident configuration file > external_pid_file = '/var/run/postgresql/9.4-main.pid'# write an extra PID file > listen_addresses = '0.0.0.0' > port = 5432# (change requires restart) > max_connections = 10 > unix_socket_directories = '/var/run/postgresql'# comma-separated list of directories > ssl = true# (change requires restart) > ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem'# (change requires restart) > ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key'# (change requires restart) > shared_buffers = 256MB > work_mem = 256MB > maintenance_work_mem = 128MB > dynamic_shared_memory_type = posix# the default is the first option > wal_level = hot_standby > wal_buffers = 16MB > checkpoint_segments = 64 > checkpoint_completion_target = 0.7 > max_wal_senders = 6 > wal_keep_segments = 8 > effective_cache_size = 256MB > default_statistics_target = 100 > logging_collector = on > log_directory = '/var/log/postgresql' > log_filename = 'postgresql-%Y-%m-%d.log' > log_rotation_age = 1d > log_min_duration_statement = 5000 > log_line_prefix = '%t ' > log_timezone = 'localtime' > stats_temp_directory = '/var/run/postgresql/9.4-main.pg_stat_tmp' > log_autovacuum_min_duration = -1 > autovacuum_max_workers = 3 > autovacuum_naptime = 15min > autovacuum_vacuum_threshold = 50 > autovacuum_analyze_threshold = 50 > autovacuum = on > datestyle = 'iso, mdy' > timezone = 'UTC' > timezone = 'Europe/Athens' > client_encoding = UTF8 > lc_messages = 'en_US.UTF-8'# locale for system error message > lc_monetary = 'en_US.UTF-8'# locale for monetary formatting > lc_numeric = 'en_US.UTF-8'# locale for number formatting > lc_time = 'en_US.UTF-8'# locale for time formatting > default_text_search_config = 'pg_catalog.english' > > Thanks, > > Dimitris -- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt --------------050109050808010609000909 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
Καλημέρα Δημήτρη

On 20/10/2016 12:04, Κοκμάδης Δημήτριος wrote:
Hello,

I am trying to create a docker Postgres container with database inside. 

When I try to run the container I have the following error

2016-10-20 08:58:33 UTC  FATAL:  the database system is starting up
2016-10-20 08:58:33 UTC  DEBUG:  shmem_exit(1): 0 before_shmem_exit callbacks to make
2016-10-20 08:58:33 UTC  DEBUG:  shmem_exit(1): 0 on_shmem_exit callbacks to make
2016-10-20 08:58:33 UTC  DEBUG:  proc_exit(1): 1 callbacks to make
2016-10-20 08:58:33 UTC  DEBUG:  exit(1)


In IPC-enabled/compiled versions you might want to set some kernel tunables related to IPC :
sysctl -a | grep -e 'sem|shm'
and adjust accordingly.
It seems that your installation uses mmap so you gotta handle this error first :
"mmap with MAP_HUGETLB failed, huge pages disabled: Cannot allocate memory"

See some Docker info how to resolve this.


The entry point is

su -c "/usr/lib/postgresql/9.4/bin/postgres -d 3 -D /var/lib/postgresql/9.4/main -c config_file=/etc/postgresql/9.4/main/postgresql.conf" postgres

and the output of command

2016-10-20 08:56:58 UTC  DEBUG:  postgres: PostmasterMain: initial environment dump:
2016-10-20 08:56:58 UTC  DEBUG:  -----------------------------------------
2016-10-20 08:56:58 UTC  DEBUG:   HOSTNAME=c0e6a383b652
2016-10-20 08:56:58 UTC  DEBUG:   SHELL=/bin/bash
2016-10-20 08:56:58 UTC  DEBUG:   TERM=xterm
2016-10-20 08:56:58 UTC  DEBUG:   USER=postgres
2016-10-20 08:56:58 UTC  DEBUG:   MAIL=/var/mail/postgres
2016-10-20 08:56:58 UTC  DEBUG:   PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
2016-10-20 08:56:58 UTC  DEBUG:   _=/usr/lib/postgresql/9.4/bin/postgres
2016-10-20 08:56:58 UTC  DEBUG:   PWD=/var/ansible
2016-10-20 08:56:58 UTC  DEBUG:   LANG=en_US.UTF-8
2016-10-20 08:56:58 UTC  DEBUG:   HOME=/var/lib/postgresql
2016-10-20 08:56:58 UTC  DEBUG:   SHLVL=2
2016-10-20 08:56:58 UTC  DEBUG:   LOGNAME=postgres
2016-10-20 08:56:58 UTC  DEBUG:   PGLOCALEDIR=/usr/share/locale
2016-10-20 08:56:58 UTC  DEBUG:   PGSYSCONFDIR=/etc/postgresql-common
2016-10-20 08:56:58 UTC  DEBUG:   LC_COLLATE=en_US.UTF-8
2016-10-20 08:56:58 UTC  DEBUG:   LC_CTYPE=en_US.UTF-8
2016-10-20 08:56:58 UTC  DEBUG:   LC_MESSAGES=en_US.UTF-8
2016-10-20 08:56:58 UTC  DEBUG:   LC_MONETARY=C
2016-10-20 08:56:58 UTC  DEBUG:   LC_NUMERIC=C
2016-10-20 08:56:58 UTC  DEBUG:   LC_TIME=C
2016-10-20 08:56:58 UTC  DEBUG:  -----------------------------------------
2016-10-20 08:56:58 UTC  DEBUG:  invoking IpcMemoryCreate(size=294363136)
2016-10-20 08:56:58 UTC  DEBUG:  mmap with MAP_HUGETLB failed, huge pages disabled: Cannot allocate memory
2016-10-20 08:56:58 UTC  DEBUG:  SlruScanDirectory invoking callback on pg_notify/0000
2016-10-20 08:56:58 UTC  DEBUG:  removing file "pg_notify/0000"
2016-10-20 08:56:58 UTC  DEBUG:  dynamic shared memory system will support 108 segments
2016-10-20 08:56:58 UTC  DEBUG:  created dynamic shared memory control segment 1804289383 (876 bytes)
2016-10-20 08:56:58 UTC  DEBUG:  max_safe_fds = 984, usable_fds = 1000, already_open = 6
2016-10-20 08:56:58 UTC  LOG:  redirecting log output to logging collector process
2016-10-20 08:56:58 UTC  HINT:  Future log output will appear in directory "/var/log/postgresql".
2016-10-20 09:00:41 UTC  DEBUG:  logger shutting down
2016-10-20 09:00:41 UTC  DEBUG:  shmem_exit(0): 0 before_shmem_exit callbacks to make
2016-10-20 09:00:41 UTC  DEBUG:  shmem_exit(0): 0 on_shmem_exit callbacks to make
2016-10-20 09:00:41 UTC  DEBUG:  proc_exit(0): 0 callbacks to make
2016-10-20 09:00:41 UTC  DEBUG:  exit(0)
2016-10-20 09:00:41 UTC  DEBUG:  shmem_exit(-1): 0 before_shmem_exit callbacks to make
2016-10-20 09:00:41 UTC  DEBUG:  shmem_exit(-1): 0 on_shmem_exit callbacks to make
2016-10-20 09:00:41 UTC  DEBUG:  proc_exit(-1): 0 callbacks to make


My configuration parameters are

data_directory = '/var/lib/postgresql/9.4/main' # use data in another directory
hba_file = '/etc/postgresql/9.4/main/pg_hba.conf' # host-based authentication file
ident_file = '/etc/postgresql/9.4/main/pg_ident.conf' # ident configuration file
external_pid_file = '/var/run/postgresql/9.4-main.pid' # write an extra PID file
listen_addresses = '0.0.0.0'
port = 5432 # (change requires restart)
max_connections = 10
unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories
ssl = true # (change requires restart)
ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem' # (change requires restart)
ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key' # (change requires restart)
shared_buffers = 256MB
work_mem = 256MB
maintenance_work_mem = 128MB
dynamic_shared_memory_type = posix # the default is the first option
wal_level = hot_standby
wal_buffers = 16MB
checkpoint_segments = 64
checkpoint_completion_target = 0.7
max_wal_senders = 6
wal_keep_segments = 8
effective_cache_size = 256MB
default_statistics_target = 100
logging_collector = on
log_directory = '/var/log/postgresql'
log_filename = 'postgresql-%Y-%m-%d.log'
log_rotation_age = 1d
log_min_duration_statement = 5000
log_line_prefix = '%t  '
log_timezone = 'localtime'
stats_temp_directory = '/var/run/postgresql/9.4-main.pg_stat_tmp'
log_autovacuum_min_duration = -1
autovacuum_max_workers = 3
autovacuum_naptime = 15min
autovacuum_vacuum_threshold = 50
autovacuum_analyze_threshold = 50
autovacuum = on
datestyle = 'iso, mdy'
timezone = 'UTC'
timezone = 'Europe/Athens'
client_encoding = UTF8
lc_messages = 'en_US.UTF-8' # locale for system error message
lc_monetary = 'en_US.UTF-8' # locale for monetary formatting
lc_numeric = 'en_US.UTF-8' # locale for number formatting
lc_time = 'en_US.UTF-8' # locale for time formatting
default_text_search_config = 'pg_catalog.english'

Thanks,

Dimitris


-- 
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt
--------------050109050808010609000909--