For a demonstration project of ours we need a database.
(First we made sure that our Docker client was running on the localhost)
Phoenix comes with PostgreSQL setup baked in hence we went with that
% docker volume create ticket ticket
We needed somewhere to persist the data so we started by creating a volume and then turned on
% docker run -it --rm -v ticket:/var/lib/postgresql/data -e POSTGRES_PASSWORD=secret postgres
Docker didn't find any image locally - but that didn't stop it:
Unable to find image 'postgres:latest' locally latest: Pulling from library/postgres bb79b6b2107f: Pull complete e3dc51fa2b56: Pull complete f213b6f96d81: Pull complete 2780ac832fde: Pull complete ae5cee1a3f12: Pull complete 95db3c06319e: Pull complete 475ca72764d5: Pull complete 8d602872ecae: Pull complete c4fca31f2e3d: Pull complete a00c442835e0: Pull complete 2e2305af3390: Pull complete 6cff852bb872: Pull complete 25bb0be11543: Pull complete 4738c099c4ad: Pull complete Digest: sha256:8f7c3c9b61d82a4a021da5d9618faf056633e089302a726d619fa467c73609e4 Status: Downloaded newer image for postgres:latest 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 dynamic shared memory implementation ... posix selecting default max_connections ... 100 selecting default shared_buffers ... 128MB selecting default time zone ... Etc/UTC creating configuration files ... ok running bootstrap script ... ok performing post-bootstrap initialization ... ok syncing data to disk ... ok initdb: warning: enabling "trust" authentication for local connectionsYou 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. Success. You can now start the database server using: pg_ctl -D /var/lib/postgresql/data -l logfile start waiting for server to start.... 2020-11-09 17:15:34.273 UTC  LOG: starting PostgreSQL 13.0 (Debian 13.0-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit 2020-11-09 17:15:34.275 UTC  LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"2020-11-09 17:15:34.285 UTC  LOG: database system was shut down at 2020-11-09 17:15:34 UTC 2020-11-09 17:15:34.291 UTC  LOG: database system is ready to accept connectionsdoneserver started /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/* 2020-11-09 17:15:34.351 UTC  LOG: received fast shutdown requestwaiting for server to shut down.... 2020-11-09 17:15:34.354 UTC  LOG: aborting any active transactions 2020-11-09 17:15:34.356 UTC  LOG: background worker "logical replication launcher" (PID 55) exited with exit code 1 2020-11-09 17:15:34.357 UTC  LOG: shutting down 2020-11-09 17:15:34.375 UTC  LOG: database system is shut down done server stopped PostgreSQL init process complete; ready for start up. 2020-11-09 17:15:34.484 UTC  LOG: starting PostgreSQL 13.0 (Debian 13.0-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit 2020-11-09 17:15:34.485 UTC  LOG: listening on IPv4 address "0.0.0.0", port 5432 2020-11-09 17:15:34.485 UTC  LOG: listening on IPv6 address "::", port 543 22020-11-09 17:15:34.488 UTC  LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" 2020-11-09 17:15:34.492 UTC  LOG: database system was shut down at 2020-11-09 17:15:34 UTC 2020-11-09 17:15:34.500 UTC  LOG: database system is ready to accept connections
With the Postgres ready we now had us a container with a database!
Notice that line
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". ? I have a feeling that is going to hurt us later on, but for now we're good..
For more on this read on here