Hello,
The problem is that I am not able to set kernel parameters inside docker as it is running as readonly
sysctl: setting key "kernel.sem": Read-only file system
Thanks,
Dimitris
2016-10-20 12:31 GMT+03:00 Achilleas Mantzios <achill@xxxxxxxxxxxxxxxxxxxxx>:
Καλημέρα Δημήτρη
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 up2016-10-20 08:58:33 UTC DEBUG: shmem_exit(1): 0 before_shmem_exit callbacks to make2016-10-20 08:58:33 UTC DEBUG: shmem_exit(1): 0 on_shmem_exit callbacks to make2016-10-20 08:58:33 UTC DEBUG: proc_exit(1): 1 callbacks to make2016-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=c0e6a383b6522016-10-20 08:56:58 UTC DEBUG: SHELL=/bin/bash2016-10-20 08:56:58 UTC DEBUG: TERM=xterm2016-10-20 08:56:58 UTC DEBUG: USER=postgres2016-10-20 08:56:58 UTC DEBUG: MAIL=/var/mail/postgres2016-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/ansible2016-10-20 08:56:58 UTC DEBUG: LANG=en_US.UTF-82016-10-20 08:56:58 UTC DEBUG: HOME=/var/lib/postgresql2016-10-20 08:56:58 UTC DEBUG: SHLVL=22016-10-20 08:56:58 UTC DEBUG: LOGNAME=postgres2016-10-20 08:56:58 UTC DEBUG: PGLOCALEDIR=/usr/share/locale2016-10-20 08:56:58 UTC DEBUG: PGSYSCONFDIR=/etc/postgresql-common 2016-10-20 08:56:58 UTC DEBUG: LC_COLLATE=en_US.UTF-82016-10-20 08:56:58 UTC DEBUG: LC_CTYPE=en_US.UTF-82016-10-20 08:56:58 UTC DEBUG: LC_MESSAGES=en_US.UTF-82016-10-20 08:56:58 UTC DEBUG: LC_MONETARY=C2016-10-20 08:56:58 UTC DEBUG: LC_NUMERIC=C2016-10-20 08:56:58 UTC DEBUG: LC_TIME=C2016-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 memory2016-10-20 08:56:58 UTC DEBUG: SlruScanDirectory invoking callback on pg_notify/00002016-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 segments2016-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 = 62016-10-20 08:56:58 UTC LOG: redirecting log output to logging collector process2016-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 down2016-10-20 09:00:41 UTC DEBUG: shmem_exit(0): 0 before_shmem_exit callbacks to make2016-10-20 09:00:41 UTC DEBUG: shmem_exit(0): 0 on_shmem_exit callbacks to make2016-10-20 09:00:41 UTC DEBUG: proc_exit(0): 0 callbacks to make2016-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 make2016-10-20 09:00:41 UTC DEBUG: shmem_exit(-1): 0 on_shmem_exit callbacks to make2016-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 directoryhba_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 = 10unix_socket_directories = '/var/run/postgresql' # comma-separated list of directoriesssl = 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 = 256MBwork_mem = 256MBmaintenance_work_mem = 128MBdynamic_shared_memory_type = posix # the default is the first optionwal_level = hot_standbywal_buffers = 16MBcheckpoint_segments = 64checkpoint_completion_target = 0.7max_wal_senders = 6wal_keep_segments = 8effective_cache_size = 256MBdefault_statistics_target = 100logging_collector = onlog_directory = '/var/log/postgresql'log_filename = 'postgresql-%Y-%m-%d.log'log_rotation_age = 1dlog_min_duration_statement = 5000log_line_prefix = '%t 'log_timezone = 'localtime'stats_temp_directory = '/var/run/postgresql/9.4-main.pg_stat_tmp' log_autovacuum_min_duration = -1autovacuum_max_workers = 3autovacuum_naptime = 15minautovacuum_vacuum_threshold = 50autovacuum_analyze_threshold = 50autovacuum = ondatestyle = 'iso, mdy'timezone = 'UTC'timezone = 'Europe/Athens'client_encoding = UTF8lc_messages = 'en_US.UTF-8' # locale for system error messagelc_monetary = 'en_US.UTF-8' # locale for monetary formattinglc_numeric = 'en_US.UTF-8' # locale for number formattinglc_time = 'en_US.UTF-8' # locale for time formattingdefault_text_search_config = 'pg_catalog.english'
Thanks,
Dimitris
-- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt