docker postgres pgadmin local connection

前端 未结 16 2300
清歌不尽
清歌不尽 2020-12-02 06:44

I have created an ubuntu image with nginx, php and postgres.

I want to connect the postgres database in my current image with pgadmin located on my loca

16条回答
  •  日久生厌
    2020-12-02 07:06

    Alternatively, you could combine Postgres and Pgadmin in one docker-compose file, and login as user pgadmin4@pgadmin.org, pwd: admin. To add the Posgres server, use hostname postgres, port 5432.

    version: '3'
    services:
      postgres:
        image: postgres
        hostname: postgres
        ports:
          - "6543:5432"
        environment:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
          POSTGRES_DB: TEST_SM
        volumes:
          - postgres-data:/var/lib/postgresql/data
        restart: unless-stopped
    
      pgadmin:
        image: dpage/pgadmin4
        depends_on:
          - postgres
        ports:
          - "5555:80"
        environment:
          PGADMIN_DEFAULT_EMAIL: pgadmin4@pgadmin.org
          PGADMIN_DEFAULT_PASSWORD: admin
        restart: unless-stopped
    
    volumes:
      postgres-data:
    

提交回复
热议问题