0

I implement a java microservice application deployed under a docker using postgres as data base. I am on MAC. Yesterday I created successfully a connection on DBeaver using the host of my MAC : 192.168.1.73. Today, I cannot connect with this host.

I tried $ telnet 192.168.1.73 5432 and had the following output

Trying 192.168.1.73...
telnet: connect to address 192.168.1.73: Connection refused
telnet: Unable to connect to remote host

What can I do ?

EDIT

I run docker-compose.yml

here is the extract for the data base

  database:
    image: postgres:9.5
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=Esprit292948
      - POSTGRES_DB=immo_db_local

Here is the begining of docker-compose.yml. I voluntarelly hid the details

version: '2'
services:
  eurekaserver:
    image:   ...
    ports:
      - ...
  configserver:
    image: ...
    ports:
      - ...
    environment:
      EUREKASERVER_URI: ...
      EUREKASERVER_PORT: ...
      ENCRYPT_KEY:       ...
  gateservice:
    image: ...
    ports:
      - ...
    environment:
      PROFILE: ...
      SERVER_PORT: ...
      CONFIGSERVER_URI: ...
      EUREKASERVER_URI: ...
      EUREKASERVER_PORT:        ...
      DATABASESERVER_PORT:      "5432"
      CONFIGSERVER_PORT:        "8888"
      AUDIT_PORT:               "8087"
      DB_PORT:                  "8930"
  database:
    image: postgres:9.5
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=Esprit292948
      - POSTGRES_DB=immo_db_local
  optimisationfiscaleservice:
    image: ...
    ports:
      - ...
    etc......

Here is the ifconfig result

$ ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
    inet 127.0.0.1 netmask 0xff000000 
    inet6 ::1 prefixlen 128 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
    nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=50b<RXCSUM,TXCSUM,VLAN_HWTAGGING,AV,CHANNEL_IO>
    ether a8:20:66:31:0a:2a 
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect (none)
    status: inactive
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=400<CHANNEL_IO>
    ether 20:c9:d0:e0:5d:a1 
    inet6 fe80::41:83de:7236:ba7a%en1 prefixlen 64 secured scopeid 0x5 
    inet 192.168.1.73 netmask 0xffffff00 broadcast 192.168.1.255
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    options=460<TSO4,TSO6,CHANNEL_IO>
    ether 82:0a:60:f7:bc:80 
    media: autoselect <full-duplex>
    status: inactive
fw0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 4078
    lladdr a8:20:66:ff:fe:83:de:f2 
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect <full-duplex>
    status: inactive
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=63<RXCSUM,TXCSUM,TSO4,TSO6>
    ether 82:0a:60:f7:bc:80 
    Configuration:
        id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
        maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
        root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
        ipfilter disabled flags 0x0
    member: en2 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 6 priority 0 path cost 0
    nd6 options=201<PERFORMNUD,DAD>
    media: <unknown type>
    status: inactive
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
    options=400<CHANNEL_IO>
    ether 02:c9:d0:e0:5d:a1 
    media: autoselect
    status: inactive
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1484
    options=400<CHANNEL_IO>
    ether 0e:b6:7e:12:5d:fb 
    inet6 fe80::cb6:7eff:fe12:5dfb%awdl0 prefixlen 64 scopeid 0xa 
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
    inet6 fe80::3b2:bb0f:18:dcb7%utun0 prefixlen 64 scopeid 0xb 
    nd6 options=201<PERFORMNUD,DAD>
utun1: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
    inet6 fe80::b744:4974:1dd2:5fda%utun1 prefixlen 64 scopeid 0xc 
    nd6 options=201<PERFORMNUD,DAD>
6
  • Can you explain more, where your java micro-service running? and how you are running it? Is it docker-compose.yml or just Docker? Please add the instructions how Postgres is running. Commented Jun 5, 2020 at 10:01
  • please check your docker bridge IP for connection or else use docker-compose in which you can provide service name for connection and create network also. also verify your host IP same not changing with time. Commented Jun 5, 2020 at 10:05
  • see EDIT. I use docker-compose.yml Commented Jun 5, 2020 at 10:19
  • What I don't understand is that it was working yesterday Commented Jun 5, 2020 at 10:25
  • Can you add your service as well? Is it running locally on your machine or also in container? Commented Jun 5, 2020 at 10:26

1 Answer 1

0

I didn't pay attention, there was an error message

Name does not resolve

So I added "apk add bind-tools" to the docker files to get logs, according to this post : Docker Compose and Postgres : Name does not resolve

After which I had another error

Docker error : no space left on device

So according to this post Docker error : no space left on device : I run

docker system prune

And then, I succedded to connect with DBeaver

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.