Search code examples
dockernetwork-programmingdocker-composedocker-network

Docker port not passing through


For some reason my docker port is not accesible from other containers.

*here i am in the container

curl 0.0.0.0:26657/unconfirmed_txs

and it gives me a response, however when I am in other containers or localhost

root@vultr:~# curl localhost:26657/unconfirmed_txs
curl: (56) Recv failure: Connection reset by peer

in another container

curl pocket:26657/unconfirmed_txs
curl: (7) Failed to connect to pocket port 26657 after 0 ms: Connection refused

The docker compose:

  pocket:
    container_name: pocket
    cap_add:
    - ALL
    build: ./pocket/
    ports:
    - "8081:8081"
    - "26656:26656"
    - "26657:26657"
    volumes:
    - "./data/.pocket/:/root/.pocket/"

Any help is much appreciated, thanks!!


Solution

  • I found the answer, my program was listening on localhost (127.0.0.1) and not 0.0.0.0, even though it worked when I queried 0.0.0.0. Once I switched it to 0.0.0.0 the problem was solved :)