• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

? Set Up PostgreSQL and Adminer Using Docker for Local Web Development

Lomanu4 Оффлайн

Lomanu4

Команда форума
Администратор
Регистрация
1 Мар 2015
Сообщения
1,481
Баллы
155
Setting up a local database environment for development shouldn’t be a hassle. Whether you’re building microservices or monolithic applications, Docker makes it incredibly easy to run PostgreSQL and Adminer locally without polluting your host system.

In this article, you’ll learn how to use Docker Compose to spin up a PostgreSQL container along with Adminer — a lightweight and powerful database management tool, often considered a simpler alternative to pgAdmin.


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



PostgreSql and Adminer using Docker Compose

✅ Prerequisites


Before we begin, make sure you have the following installed on your machine:

  • Docker
  • Docker Compose

These tools work on Windows, macOS, and Linux.

? Step-by-Step Setup Guide

? Step 1: Create a project folder



Open your terminal and run the following:


mkdir postgres-docker-setup
cd postgres-docker-setup

This will be the root folder for your setup.

? Step 2: Create the docker-compose.yml file


Inside the folder, create a file named docker-compose.yml and paste the following content:




services:
# PostgreSQL
postgres:
image: postgres:17
container_name: postgres
restart: unless-stopped
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
PGPASSWORD: admin
POSTGRES_USER: admin
POSTGRES_PASSWORD: admin
POSTGRES_DB: mydb
networks:
- postgres-network
#adminer
adminer:
image: adminer:5.2.1
container_name: adminer
restart: unless-stopped
ports:
- "8080:8080"
environment:
ADMINER_DEFAULT_SERVER: postgres
networks:
- postgres-network

networks:
postgres-network:
driver: bridge

volumes:
postgres-data:
driver: local

What this does:

  • Sets up a PostgreSQL container with a custom user and password.
  • Persist your data using a Docker volume.
  • Launches Adminer for easy database access via your browser.
  • Exposes PostgreSQL on port 5432 and Adminer on port 8080.
? Step 3: Launch the containers


In the terminal, run:


docker compose up -d

Docker will download the required images and start the containers in the background.

✅ Step 4: Access Adminer in the browser


Go to:



Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.


Fill in the login form like this:

  • System: PostgreSQL
  • Server: postgres
  • Username: admin
  • Password: admin
  • Database: mydb


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



Once logged in, you’ll have full access to your PostgreSQL database through a friendly interface.

? Step 5: Stop and clean up (optional)


To shut everything down and remove the volumes:


docker compose down
? Conclusion


GitHub Link:

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



YouTube:

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.




With just a single YAML file and a couple of terminal commands, you can have a fully functional PostgreSQL environment for local development. Adminer provides an elegant way to browse and manage your data without having to install extra software on your machine.

If this guide helped you, consider bookmarking it or leaving a comment. Would you like to see similar Docker-based setups for MongoDB, Redis, or Elasticsearch? Let me know!


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу