Giter Club home page Giter Club logo

Comments (5)

dencold avatar dencold commented on September 27, 2024

hey @eleijonmarck apologies for the long delay responding to you. I haven't been actively developing the pgcli tool lately. Did you ever get a solution to this issue? If so, let me know and I'll see if I can apply it to master. Thanks!

from pgcli-docker.

eleijonmarck avatar eleijonmarck commented on September 27, 2024

Not able to solve it, I think I worked around it somehow šŸ¤” . Too long as I do not remember how unfortunately

from pgcli-docker.

dencold avatar dencold commented on September 27, 2024

Okay, I'm going to close this. If you remember the workaround, feel free to reach out again.

from pgcli-docker.

slnt avatar slnt commented on September 27, 2024

@dencold I was having this issue as well.

ā†’ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
c41203851c34        postgres:11.8       "docker-entrypoint.sā€¦"   19 hours ago        Up 19 hours         0.0.0.0:5432->5432/tcp   pg11

ā†’ docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
f4e0cb563629        partition_network   bridge              local

The image was run using docker-compose up.

version: '3.5'
services:
    db:
        image: postgres:11.8
        container_name: pg11
        environment:
            ...
        ports:
            - 5432:5432
        networks:
            - backend
networks:
    backend:
        name: partition_network
        driver: bridge

I've been trying to connect using:

ā†’ docker run -it --link pg11:postgres --rm dencold/pgcli
docker: Error response from daemon: Cannot link to /pg11, as it does not belong to the default network.

When I add in the network I get a fresh, new error:

ā†’ docker run -it --network partition_network --link pg11:postgres --rm dencold/pgcli
Database URL not provided, please try again.

3 ways to use this container:

1. Directly pass the database url:
   docker run -it --rm dencold/pgcli postgres://DBUSER:DBPASS@DBHOST:DBPORT
2. Pass an environment variable via docker's '-e' argument
   docker run -it --rm -e DB_URL=postgres://DBUSER:DBPASS@DBHOST:DBPORT dencold/pgcli
3. Automatically connect via a linked postgres container (my favorite):
   docker run -it --rm --link YOURCONTAINER:postgres dencold/pgcli

from pgcli-docker.

slnt avatar slnt commented on September 27, 2024

Following up:

In order to get this to kind of work, although not the same way exactly, I modified my docker-compose.yml to:

version: '3.5'
services:
    db:
        image: postgres:11.8
        container_name: pg11
        environment:
            ...
        ports:
            - 5432:5432
        network_mode: bridge

and was able to successfully link my way to success.

from pgcli-docker.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.