docker postgres pgadmin local connection

前端 未结 16 2301
清歌不尽
清歌不尽 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 06:54

    In my case, I had a PostgreSQL container, so I didn't change my container or create a docker-compose approach, I needed pgadming after few months to had installed PostgreSQL, so this is my approach:

    1. docker inspect my_container_id_postgreSQL
    2. The network assigned to PostgreSQL was:

      "Networks": { "docker_default": { "IPAddress": "172.18.0.2", ... } }

    3. Ran my PGADMIN with --network command.

      docker run -p 85:80 --network docker_default -e 'PGADMIN_DEFAULT_EMAIL=user@domain.com' -e 'PGADMIN_DEFAULT_PASSWORD=SuperSecret' -d dpage/pgadmin4

    4. Insert the Ip address into pgAdmin and the database credentials used in docker.

    I hope this can be useful for someone. Regards.

提交回复
热议问题