{"id":21838755,"url":"https://github.com/thatbeautifuldream/postgres","last_synced_at":"2026-04-17T15:03:47.124Z","repository":{"id":239471005,"uuid":"799618495","full_name":"thatbeautifuldream/postgres","owner":"thatbeautifuldream","description":"Quickly setup postgres and adminer from a docker compose","archived":false,"fork":false,"pushed_at":"2024-06-25T07:17:12.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-26T10:41:34.407Z","etag":null,"topics":["adminer","docker","postgres"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thatbeautifuldream.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-12T17:12:30.000Z","updated_at":"2024-06-25T07:17:15.000Z","dependencies_parsed_at":"2024-05-12T18:31:28.940Z","dependency_job_id":"5be11cc3-f74f-4160-acf3-469ddd68dd17","html_url":"https://github.com/thatbeautifuldream/postgres","commit_stats":null,"previous_names":["thatbeautifuldream/postgres"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thatbeautifuldream%2Fpostgres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thatbeautifuldream%2Fpostgres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thatbeautifuldream%2Fpostgres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thatbeautifuldream%2Fpostgres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thatbeautifuldream","download_url":"https://codeload.github.com/thatbeautifuldream/postgres/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244819802,"owners_count":20515646,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adminer","docker","postgres"],"created_at":"2024-11-27T21:14:16.488Z","updated_at":"2026-04-17T15:03:47.086Z","avatar_url":"https://github.com/thatbeautifuldream.png","language":null,"readme":"# PostgreSQL with Adminer Docker Compose Setup\n\nThis repository contains a Docker Compose configuration for setting up a PostgreSQL database container along with an Adminer container for a web-based database management interface.\n\n## Prerequisites\n\n- Docker Engine installed on your machine\n- Docker Compose installed on your machine\n\n## Getting Started\n\n1. Clone this repository or copy the `docker-compose.yml` file to your local machine.\n\n2. Navigate to the directory containing the `docker-compose.yml` file.\n\n3. Run the following command to start the containers:\n\n`docker-compose up -d`\n\nThis command will start the PostgreSQL and Adminer containers in detached mode.\n\n## Configuration\n\nThe `docker-compose.yml` file is configured as follows:\n\n```yaml\nversion: \"3\"\nservices:\n  db:\n    image: postgres\n    restart: always\n    volumes:\n      - ./data/db:/var/lib/postgresql/data\n    ports:\n      - 5432:5432\n    environment:\n      - POSTGRES_DB=postgres\n      - POSTGRES_USER=postgres\n      - POSTGRES_PASSWORD=postgres\n\n  adminer:\n    image: adminer\n    restart: always\n    ports:\n      - 8080:8080\n```\n\n### PostgreSQL Container\n\n- `image: postgres`: Uses the official PostgreSQL Docker image.\n- `restart: always`: Ensures that the container restarts automatically if it stops for any reason.\n- `volumes`: Mounts a local directory (`./data/db`) to the container's `/var/lib/postgresql/data` directory, which is where PostgreSQL stores its data. This allows data persistence across container restarts or removals.\n- `ports`: Maps the host's port 5432 to the container's port 5432, allowing access to the PostgreSQL server from the host machine.\n- `environment`: Sets the following environment variables:\n  - `POSTGRES_DB`: The name of the default database to be created.\n  - `POSTGRES_USER`: The username for the default user.\n  - `POSTGRES_PASSWORD`: The password for the default user.\n\n### Adminer Container\n\n- `image: adminer`: Uses the official Adminer Docker image.\n- `restart: always`: Ensures that the container restarts automatically if it stops for any reason.\n- `ports`: Maps the host's port 8080 to the container's port 8080, allowing access to the Adminer web interface from the host machine.\n\n## Accessing the Database\n\n### Using psql\n\nTo access the PostgreSQL database running in the Docker container, you can use a PostgreSQL client like `psql`.\n\n1. Find the container ID or name using the `docker ps` command.\n\n2. Connect to the database using the following command:\n\n```bash\ndocker exec -it \u003ccontainer-id-or-name\u003e psql -U postgres\n```\n\nReplace `\u003ccontainer-id-or-name\u003e` with the actual container ID or name of the PostgreSQL container.\n\n3. When prompted, enter the password specified in the `docker-compose.yml` file (`postgres` in this case).\n\nYou can now interact with the PostgreSQL database using the `psql` prompt.\n\n### Using Adminer\n\nTo access the Adminer web interface, open your web browser and navigate to `http://localhost:8080`.\n\nYou should see the Adminer login page. Enter the following credentials:\n\n- System: `PostgreSQL`\n- Server: `db` (or the container name/ID of the PostgreSQL container)\n- Username: `postgres`\n- Password: `postgres`\n- Database: `postgres`\n\nClick \"Login\" to access the Adminer interface and manage your PostgreSQL database.\n\n## Data Persistence\n\nThe PostgreSQL data is stored in the `./data/db` directory on your local machine, which is mounted to the container's `/var/lib/postgresql/data` directory. This ensures that your data persists even if you stop or remove the container.\n\n## Cleanup\n\nTo stop and remove the PostgreSQL and Adminer containers, run the following command:\n\n```bash\ndocker-compose down\n```\n\nThis command will stop and remove the containers, as well as the associated network.\n\nIf you want to remove the persistent data stored in the `./data/db` directory, you can manually delete it after stopping the containers.\n\n```bash\nrm -rf ./data/db\n```\n\nChange permissions of the `./data/db` directory if needed.\n\n## Access psql in the container\n\n```bash\ndocker exec -it \u003ccontainer-id-or-name \"postgres-db-1\"\u003e bash\npsql -U postgres\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthatbeautifuldream%2Fpostgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthatbeautifuldream%2Fpostgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthatbeautifuldream%2Fpostgres/lists"}