Formulir Kontak

Nama

Email *

Pesan *

Cari Blog Ini

Docker Compose Pgadmin

Deploying PostgreSQL and pgAdmin in a Docker Container

Introduction

Docker is a platform for deploying applications in containers, making it easy to package, ship, and run applications consistently across different environments. In this article, we will learn how to deploy a PostgreSQL database server and a pgAdmin4 client using Docker.

Prerequisites

To follow this guide, you will need: * Docker installed on your system * A text editor

Steps

1. **Create a Docker Compose file** Create a file named `docker-compose.yml` with the following content: ```yaml version: '3' services: postgresql: image: postgres:latest environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: mypassword POSTGRES_DB: mydatabase ports: - "5432:5432" pgadmin: image: dpage/pgadmin4 ports: - "8080:80" ``` 2. **Build the images** Run the following command to build the Docker images: ``` docker-compose build ``` 3. **Start the containers** Run the following command to start the containers: ``` docker-compose up -d ``` 4. **Access the pgAdmin interface** Once the containers are running, you can access the pgAdmin interface by navigating to `http://localhost:8080` in your web browser.

Conclusion

In this article, we have demonstrated how to seamlessly integrate and deploy PostgreSQL and pgAdmin in a Docker container. You can now easily manage your PostgreSQL databases and interact with them through the pgAdmin interface.


Komentar