docker postgres pgadmin local connection

前端 未结 16 2309
清歌不尽
清歌不尽 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:02

    This is what i did

    for postgres

    docker run -p 5432:5432  --name container-postgresdb -e POSTGRES_PASSWORD=admin -d postgres
    

    for pgadmin

    docker run -p 5050:80  -e "PGADMIN_DEFAULT_EMAIL=name@example.com" -e "PGADMIN_DEFAULT_PASSWORD=admin"  -d dpage/pgadmin4
    

    Connection string for pgadmin

    host: host.docker.internal
    database: postgres
    user: postgres
    password: admin
    

    It works fine!!!!!

提交回复
热议问题