linux:podman:postgres

pgAdmin - PostgreSQL Tools

$ nano docker-compose.yml

services:
  postgres:
    image: postgres:16-alpine
    container_name: postgres
    environment:
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: ${POSTGRES_DB}
    volumes:
      - "./pgdata:/var/lib/postgresql/data"
    ports:
      - 5432:5432

  pgadmin:
    image: dpage/pgadmin4
    container_name: pgadmin
    ports:
      - "5480:80"
    environment:
      PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL}
      PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD}
    volumes:
      - "./pgadmin/data:/var/lib/pgadmin"
      - "./pgadmin/log:/var/log/pgadmin"

$ nano .env

POSTGRES_USER=root
POSTGRES_PASSWORD=pgsql596!
POSTGRES_DB=imgman_db

PGADMIN_DEFAULT_EMAIL=username@domain.com
PGADMIN_DEFAULT_PASSWORD=pgsql596!

ディレクトリ作成🤔

$ mkdir -p pgdata pgadmin/{data,log} && chmod 775 -R pgadmin

$ podman compose up

>>>> Executing external compose provider "/usr/libexec/docker/cli-plugins/docker-compose". Please refer to the documentation for details. <<<<

[+] Running 2/2
  Container pgadmin   Created                                                                           0.0s 
  Container postgres  Recreated                                                                         0.9s 
Attaching to pgadmin, postgres
postgres  | The files belonging to this database system will be owned by user "postgres".
postgres  | This user must also own the server process.
postgres  | 
postgres  | The database cluster will be initialized with locale "en_US.utf8".
postgres  | The default database encoding has accordingly been set to "UTF8".
postgres  | The default text search configuration will be set to "english".
postgres  | 
postgres  | Data page checksums are disabled.
postgres  | 
postgres  | fixing permissions on existing directory /var/lib/postgresql/data ... ok
postgres  | creating subdirectories ... ok
postgres  | selecting dynamic shared memory implementation ... posix
postgres  | selecting default max_connections ... 100
postgres  | selecting default shared_buffers ... 128MB
postgres  | selecting default time zone ... UTC
postgres  | creating configuration files ... ok
postgres  | running bootstrap script ... ok
postgres  | sh: locale: not found
postgres  | 2024-06-02 01:53:30.692 UTC [26] WARNING:  no usable system locales were found
postgres  | performing post-bootstrap initialization ... ok
pgadmin   | NOTE: Configuring authentication for SERVER mode.
pgadmin   | 
pgadmin   | pgAdmin 4 - Application Initialisation
pgadmin   | ======================================
pgadmin   | 
postgres  | syncing data to disk ... ok
postgres  | 
postgres  | initdb: warning: enabling "trust" authentication for local connections
postgres  | initdb: hint: 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.
postgres  | 
postgres  | Success. You can now start the database server using:
postgres  | 
postgres  |     pg_ctl -D /var/lib/postgresql/data -l logfile start
postgres  | 
postgres  | waiting for server to start....2024-06-02 01:54:14.330 UTC [32] LOG:  starting PostgreSQL 16.3 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20231014) 13.2.1 20231014, 64-bit
postgres  | 2024-06-02 01:54:14.404 UTC [32] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres  | 2024-06-02 01:54:14.620 UTC [35] LOG:  database system was shut down at 2024-06-02 01:53:32 UTC
postgres  | 2024-06-02 01:54:14.684 UTC [32] LOG:  database system is ready to accept connections
postgres  |  done
postgres  | server started
postgres  | CREATE DATABASE
postgres  | 
postgres  | 
postgres  | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
postgres  | 
postgres  | waiting for server to shut down....2024-06-02 01:54:16.036 UTC [32] LOG:  received fast shutdown request
postgres  | 2024-06-02 01:54:16.064 UTC [32] LOG:  aborting any active transactions
postgres  | 2024-06-02 01:54:16.068 UTC [32] LOG:  background worker "logical replication launcher" (PID 38) exited with exit code 1
postgres  | 2024-06-02 01:54:16.069 UTC [33] LOG:  shutting down
postgres  | 2024-06-02 01:54:16.121 UTC [33] LOG:  checkpoint starting: shutdown immediate
postgres  | .................2024-06-02 01:54:33.289 UTC [33] LOG:  checkpoint complete: wrote 924 buffers (5.6%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.216 s, sync=16.541 s, total=17.221 s; sync files=301, longest=0.324 s, average=0.055 s; distance=4267 kB, estimate=4267 kB; lsn=0/191A9F0, redo lsn=0/191A9F0
postgres  | 2024-06-02 01:54:33.306 UTC [32] LOG:  database system is shut down
postgres  |  done
postgres  | server stopped
postgres  | 
postgres  | PostgreSQL init process complete; ready for start up.
postgres  | 
postgres  | 2024-06-02 01:54:33.511 UTC [1] LOG:  starting PostgreSQL 16.3 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20231014) 13.2.1 20231014, 64-bit
postgres  | 2024-06-02 01:54:33.511 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgres  | 2024-06-02 01:54:33.511 UTC [1] LOG:  listening on IPv6 address "::", port 5432
postgres  | 2024-06-02 01:54:33.704 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres  | 2024-06-02 01:54:33.844 UTC [48] LOG:  database system was shut down at 2024-06-02 01:54:33 UTC
postgres  | 2024-06-02 01:54:33.918 UTC [1] LOG:  database system is ready to accept connections
pgadmin   | postfix/postlog: starting the Postfix mail system
pgadmin   | [2024-06-02 01:55:31 +0000] [1] [INFO] Starting gunicorn 20.1.0
pgadmin   | [2024-06-02 01:55:31 +0000] [1] [INFO] Listening at: http://[::]:80 (1)
pgadmin   | [2024-06-02 01:55:31 +0000] [1] [INFO] Using worker: gthread
pgadmin   | [2024-06-02 01:55:32 +0000] [109] [INFO] Booting worker with pid: 109

http://localhost:5480/ にアクセスする🤔
mail: username@domain.com
password: pgsql596!

pgAdmin 001 pgAdmin 002

新しいサーバーの追加🤔

名前: postgres
ホスト名: postgres
ユーザー名: root
パスワード: pgsql596!
pgAdmin 003 pgAdmin 004

  • linux/podman/postgres.txt
  • 最終更新: 2024/06/03 11:16
  • by ともやん