Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having issues to configure binance-proxy over freqtrade in docker? (Docker networking problems) #3

Open
z3nth10n opened this issue Nov 30, 2021 · 0 comments

Comments

@z3nth10n
Copy link

z3nth10n commented Nov 30, 2021

Describe your environment

  • Operating system: Debian 10
  • Python Version: 3.8.10 (python -V)
  • CCXT version: 1.59.2 (pip freeze | grep ccxt)
  • Freqtrade Version: 2021.10 (freqtrade -V or docker-compose run --rm freqtrade -V for Freqtrade running in docker)

Your question

Well, I'm trying to understand docker networking, because I'm having problems communicating two services (freqtrade + binance-proxy) without luck...

I created two containers for this, the proxy with a static IP. The gateways are the following ones:

root@DESKTOP-74LHUDF:/mnt/e/Python/freqtrade-docker# docker network inspect bot_1 | grep '"Gateway"' | head -n 1
                    "Gateway": "172.23.0.1"
root@DESKTOP-74LHUDF:/mnt/e/Python/freqtrade-docker# docker network inspect bot_2 | grep '"Gateway"' | head -n 1
                    "Gateway": "172.24.0.1"
root@DESKTOP-74LHUDF:/mnt/e/Python/freqtrade-docker# docker network inspect bot_3 | grep '"Gateway"' | head -n 1
                    "Gateway": "172.25.0.1"
root@DESKTOP-74LHUDF:/mnt/e/Python/freqtrade-docker# docker network inspect bot_4 | grep '"Gateway"' | head -n 1
                    "Gateway": "172.26.0.1"
root@DESKTOP-74LHUDF:/mnt/e/Python/freqtrade-docker# docker network inspect bot_5 | grep '"Gateway"' | head -n 1
                    "Gateway": "172.27.0.1"
root@DESKTOP-74LHUDF:/mnt/e/Python/freqtrade-docker# docker network inspect bot_6 | grep '"Gateway"' | head -n 1
                    "Gateway": "172.28.0.1"
root@DESKTOP-74LHUDF:/mnt/e/Python/freqtrade-docker# docker network inspect bot_7 | grep '"Gateway"' | head -n 1
                    "Gateway": "172.29.0.1"
root@DESKTOP-74LHUDF:/mnt/e/Python/freqtrade-docker# docker network inspect bot_8 | grep '"Gateway"' | head -n 1
                    "Gateway": "172.30.0.1"

The proxy has the following number: 172.x.0.2. (Freqtrade I cannot know, continue reading and you will know why)

I can reach the internet using docker exec -it <container_name> ping google.com, but I cannot reach a proxy created using binance-proxy although I can ping it, neither I cannot httping it nor from the host machine or from freqtrade container.

I already tried several things but I cannot see where is the problem...

I used docker inspect and docker network inspect, also I tried to execute docker exec -it ... /bin/bash to check ifconfig and iptables without luck, ping works correctly:

exec ping

It's working for only the first bot, I don't know if I used a command before to enable networking (on the first bot, because it works)

I don't know why I can't ping on the docker container but at least the proxy is reaching google DNS.

Also I tried static IPs without luck because gateway was missing on the docker inspect command:

docker inspect


This is how I run it:

bash file

#!/bin/bash

cd /mnt/e/Python/freqtrade-docker/bot_2
docker run -w="/mnt/e/Python/freqtrade-docker/bot_2" -d --name proxy_2 --net bot_2 -p 8092:8092 nightshift2k/binance-proxy:latest
docker-compose up -d

This is my docker-compose.yml file:

docker-compose.yml

---
version: '3'
services:
  freqtrade:
    image: freqtradeorg/freqtrade:stable
    restart: unless-stopped
    container_name: freqtrade_2
    volumes:
      - "./user_data:/freqtrade/user_data"
    # Expose api on port 8082 (localhost only)
    # Please read the https://www.freqtrade.io/en/stable/rest-api/ documentation
    # before enabling this.
    ports:
      - "127.0.0.1:8082:8082"
      # - "0.0.0.0:8082:8082"
    networks:
          - default
    # Default command used when running `docker compose up`
    command: >
      trade
      --logfile /freqtrade/user_data/logs/freqtrade.log
      --db-url sqlite:////freqtrade/user_data/tradesv3.sqlite
      --config /freqtrade/user_data/config.json
      --strategy xxx
networks:
  default:
    external: true
    name: bot_2

This is my docker-compose.yml for the bot... I also tried networks, 0.0.0.0 with http://172.x.0.2:8092/api/v3 instead of using localhost ip (127.0.0.1)


And also I configured correctly Freqtrade config as stated here:

config.json

Maybe the problem is with the proxy, but I cannot debug correctly the bot because it's ending every time it tries to connect...

crashes

(Just see what does on the status column)

This exception causes the program to crash and restart:

log exception

log

Is there any way to prevent the bot to restart every time it fails?

Also, what can I try more to see where is the problem? Because I have one bot working but the other ones cannot start and the config I'm using is the same. So what's going here?

I inspected the two proxy + freqtrade containers and I don't find any differences...

configs.zip

The only thing is that when I change the cctx json config to the gateway IP it's not having any problems (in the first bot) (in this case 172.x.0.1:809x/api/v3). But in the rest of the bots I'm having this error:

But if I do the same on the second bot, I'm having this other problem: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

@z3nth10n z3nth10n changed the title Having issues to configure binancy-proxy over freqtrade in docker? (Docker networking problems) Having issues to configure binance-proxy over freqtrade in docker? (Docker networking problems) Nov 30, 2021
pnmice pushed a commit to pnmice/binance-proxy that referenced this issue Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant