MTProxy icon indicating copy to clipboard operation
MTProxy copied to clipboard

Docker image doesn't starts

Open yuretzgt opened this issue 8 months ago • 6 comments

docker-compose.yml

services: mtproto: image: telegrammessenger/proxy:2.0beta volumes: - ./data:/data restart: always ports: - "8444:443"

#uname -a

Linux 3287751-5.14.0-480.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 12 20:45:27 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

#docker compose up

[+] up 1/1 ✔ Container mtproto2-mtproto-1 Recreated 0.1s Attaching to mtproto-1 mtproto-1 | #### mtproto-1 | #### Telegram Proxy mtproto-1 | #### mtproto-1 | mtproto-1 | [+] Using the secret in /data/secret: '*******'. mtproto-1 | /run.sh: line 69: ip: command not found mtproto-1 | [F] Cannot determine internal IP address. mtproto-1 exited with code 4 (restarting)

yuretzgt avatar Apr 03 '26 19:04 yuretzgt

I have the same problem.

[+] Using the secret in /data/secret: '***'.
/run.sh: line 69: ip: command not found
[F] Cannot determine internal IP address.
####
#### Telegram Proxy
####

hofry avatar Apr 03 '26 20:04 hofry

Hi guys, I created a hotfix docker image https://gitlab.com/Edge790/tg_hotfix

The problem: The script in the original docker image rely on the IP to get internal IP, it's not available in the docker image that the original image is based off, so the script fails.

The solution: to create a new docker image based of original image, and install iproute2 package which contains IP tool.

The simpliest way to use it is to replace telegrammessenger/proxy:2.0beta with registry.gitlab.com/edge790/tg_hotfix:2.0beta_fix1.0 - it will use my build image from my gitlab container registry

If you need more control or you doubt me (as you should) you can access dockerfile directly and build it manually using instructions from readme.md

The repository also have configured CI, so feel free to fork it, and use gitlab CI to build and publish it for you, if you have troubles with building it locally.

p.s. It would be so nice if we would have direct access to original Dockerfile, so we can fix problems inplace and create PR's instead of doing all of this hardway.

EdgE790 avatar Apr 04 '26 02:04 EdgE790

Full solution: you need to create second file (Dockerfile) docker-compose.yml

services:
  mtproto:
    build: .
    volumes:
      - ./data:/data
    restart: always
    ports:
        - "8444:443"

Dockerfile

FROM docker.io/telegrammessenger/proxy:2.0beta
RUN apt-get update && apt-get install -y iproute2

#docker compose up -d

yuretzgt avatar Apr 04 '26 05:04 yuretzgt

Alternative solution is to continue using the original 2.0beta image with the additional line in the compose file:

entrypoint: ["/bin/bash", "-c", "apt-get update -qq && apt-get install -y -qq iproute2 && /run.sh"]

or in case of docker CLI:

docker run -d \
  -p 443:443 \
  --name=mtproto-proxy \
  --restart=always \
  -v proxy-config:/data \
  --entrypoint /bin/bash \
  telegrammessenger/proxy:2.0beta \
  -c "apt-get update -qq && apt-get install -y -qq iproute2 && /run.sh"

kosarevp avatar Apr 04 '26 14:04 kosarevp

The upstream image is based on a stripped Debian variant that doesn't ship iproute2. The run.sh entrypoint shells out to ip for local address detection and fails hard when it's missing — no fallback.

I maintain teleproxy, an actively maintained fork. The Docker image is Alpine-based (~8 MB), includes iproute2, and falls back to /etc/hosts parsing if ip is unavailable. It also bakes proxy-secret at build time so the container doesn't fail on first start if core.telegram.org is unreachable.

docker run -d -p 443:443 ghcr.io/teleproxy/teleproxy

It auto-generates a secret and prints the tg://proxy connection link in docker logs. Multi-arch images (amd64 + arm64) are published on every release.

rkline0x avatar Apr 04 '26 16:04 rkline0x

Is that repo abandoned? Why not fix docker image ffs? @levlam

sammy007 avatar Jun 06 '26 12:06 sammy007