Я пишу Dockerfile
, который тянет внешний дамп, а затем загружает его - https://github.com/scala-eveapi/postgres-sde/commit/95d2ed70dff8326c9acc75c56c9a7b8c8f6bbc73 - работает сборщик докеров. При запуске он восстанавливал БД, но после запуска .sql он просто выходит, а не сохраняет сервер postgres.Унаследовано от postgres docker container - не удерживает демона в живых?
Файл:
FROM postgres:latest
ADD https://www.fuzzwork.co.uk/dump/latest/postgres-20161114-TRANQUILITY.dmp.bz2 sde.bz2
# ADD postgres-20161114-TRANQUILITY.dmp.bz2 sde.bz2
RUN bunzip2 sde.bz2
COPY load-sde.sh /docker-entrypoint-initdb.d/01-load-sde.sh
COPY add-constraints.sql /docker-entrypoint-initdb.d/02-add-constraints.sql
Остальные два файла:
#!/bin/bash
set -e
pg_restore -d "${POSTGRES_DB:-$POSTGRES_USER}" -U "$POSTGRES_USER" sde
И SQL:
alter table "mapSolarSystems"
alter column "solarSystemName" set not null;
alter table "invTypes"
alter column "typeName" set not null;
alter table "staStations"
alter column "stationName" set not null;
alter table "staStations"
alter column "solarSystemID" set not null;
Журналы:
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ...
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
ok
Success. You can now start the database server using:
pg_ctl -D /var/lib/postgresql/data -l logfile start
****************************************************
WARNING: No password has been set for the database.
This will allow anyone with access to the
Postgres port to access your database. In
Docker's default configuration, this is
effectively any other container on the same
system.
Use "-e POSTGRES_PASSWORD=password" to set
it in "docker run".
****************************************************
waiting for server to start....LOG: database system was shut down at 2016-12-06 12:05:18 UTC
LOG: MultiXact member wraparound protections are now enabled
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
done
server started
ALTER ROLE
/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/01-load-sde.sh
ERROR: role "yaml" does not exist
STATEMENT: ALTER TABLE "agtAgentTypes" OWNER TO yaml;
[...] pg_restore errors
WARNING: errors ignored on restore: 89
Нет CMD или ENTRYPOINT в вашем файле Docker, поэтому контейнер останавливается, что нормально – user2915097
Можете ли вы публиковать журналы из контейнера? – Yuva
Журналы публикуются. – Reactormonk