conf2proxy converts a V2Ray-compatible client config or share link into a local SOCKS5/HTTP proxy container.
This version makes build-time and runtime values explicit in .env.
TARGETARCH and TARGETVARIANT are Docker build args, not container runtime environment variables. They are used only while building the image to choose the correct V2Ray binary.
They are now defined in .env and passed through compose.yaml:
build:
args:
V2RAY_VERSION: "${V2RAY_VERSION:-5.49.0}"
TARGETARCH: "${TARGETARCH:-amd64}"
TARGETVARIANT: "${TARGETVARIANT:-}"Default .env values:
TARGETARCH=amd64
TARGETVARIANT=For ARM64:
TARGETARCH=arm64
TARGETVARIANT=For ARMv7:
TARGETARCH=arm
TARGETVARIANT=v7Choose what this container exposes locally by changing .env:
LOCAL_PROXY_PROTOCOL=socks5
PROXY_PORT=1080or:
LOCAL_PROXY_PROTOCOL=http
PROXY_PORT=1080or:
LOCAL_PROXY_PROTOCOL=both
SOCKS_PORT=1080
HTTP_PORT=1081Containerized V2Ray-compatible config-to-proxy gateway. It accepts either a native config.json, a single V2Ray-compatible share link, an environment variable link, or a base64 subscription file. It then exposes a local proxy listener selected by environment variable.
- Removed upstream input support for
socks://,socks5://,http://, andhttps://links. - Local exposed proxy is now selected with
LOCAL_PROXY_PROTOCOLincompose.yaml. - Default local listener is SOCKS5 on
127.0.0.1:1080. - HTTP proxy mode can use the same exposed port, so you do not need two ports unless you choose
both.
vmess://vless://withsecurity=tlsorsecurity=nonetrojan://withsecurity=tlsorsecurity=noness://Shadowsocks SIP002 and legacy base64 body
socks://,socks5://,http://,https://as upstream input links.vless://...security=reality...and mostflow=xtls-rprx-visionconfigs: these are Xray-side patterns.hy2://,hysteria2://,tuic://,wireguard://: these are not V2Ray-core outbound share links.ssr://: ShadowsocksR is not normal Shadowsocks SIP002.
Use a native config with the correct core if you need these protocols.
.
├── compose.yaml
├── Dockerfile
├── docker-entrypoint.sh
├── link2config.py
├── v2ray/
└── link.txt
This is the default mode.
LOCAL_PROXY_PROTOCOL: "socks5"
PROXY_PORT: "1080"Start:
nano v2ray/link.txt
docker compose up -d --buildTest:
curl --socks5-hostname 127.0.0.1:1080 https://ifconfig.meChange only this in compose.yaml:
environment:
LOCAL_PROXY_PROTOCOL: "http"
PROXY_PORT: "1080"Keep the same port mapping:
ports:
- "127.0.0.1:${HOST_PROXY_PORT:-1080}:${PROXY_PORT:-1080}/tcp"Start and test:
docker compose up -d --build
curl -x http://127.0.0.1:1080 https://ifconfig.meUse this only if you really need both protocols at the same time.
environment:
LOCAL_PROXY_PROTOCOL: "both"
SOCKS_PORT: "1080"
HTTP_PORT: "1081"
ports:
- "127.0.0.1:${HOST_PROXY_PORT:-1080}:${SOCKS_PORT:-1080}/tcp"
- "127.0.0.1:${HOST_HTTP_PORT:-1081}:${HTTP_PORT:-1081}/tcp"Test:
curl --socks5-hostname 127.0.0.1:1080 https://ifconfig.me
curl -x http://127.0.0.1:1081 https://ifconfig.mePlace your complete V2Ray client config at:
v2ray/config.json
Then start:
docker compose up -d --buildWhen native config.json exists and is non-empty, it takes priority over link.txt.
V2RAY_LINK='vless://...' docker compose up -d --buildV2RAY_LINK has the highest priority.
For LAN/public exposure, enable authentication first:
environment:
PROXY_AUTH: "password"
PROXY_USER: "proxyuser"
PROXY_PASS: "change-me"
ports:
- "0.0.0.0:${HOST_PROXY_PORT:-1080}:${PROXY_PORT:-1080}/tcp"For SOCKS5:
curl --socks5-hostname proxyuser:change-me@127.0.0.1:1080 https://ifconfig.meFor HTTP:
curl -x http://proxyuser:change-me@127.0.0.1:1080 https://ifconfig.me| Variable | Default | Description |
|---|---|---|
LOCAL_PROXY_PROTOCOL |
socks5 |
Local exposed protocol: socks5, http, or both |
PROXY_PORT |
1080 |
Main local inbound port for socks5 or http mode |
SOCKS_PORT |
1080 |
SOCKS5 port when LOCAL_PROXY_PROTOCOL=both |
HTTP_PORT |
1081 |
HTTP proxy port when LOCAL_PROXY_PROTOCOL=both |
PROXY_AUTH |
noauth |
Set to password to enable inbound auth |
PROXY_USER |
empty | Inbound auth username |
PROXY_PASS |
empty | Inbound auth password |
ENABLE_SOCKS_UDP |
true |
Enable UDP on SOCKS inbound |
ENABLE_SNIFFING |
true |
Enable V2Ray sniffing for HTTP/TLS/QUIC destination override |
ROUTE_PRIVATE_DIRECT |
true |
Route private IP/domain ranges directly |
LOGLEVEL |
warning |
V2Ray log level |
ENABLE_MUX |
false |
Enable V2Ray mux on generated proxy outbound |
V2RAY_LINK |
empty | Direct link input without mounting a file |
The container runs as non-root, drops Linux capabilities, uses no-new-privileges, mounts /etc/v2ray read-only, and uses tmpfs for generated runtime config.
Keep the host binding as 127.0.0.1 unless this proxy is intentionally shared. If you expose it on LAN or public network, enable PROXY_AUTH=password and use a strong password.
python3 -m py_compile link2config.py
python3 link2config.py v2ray/link.txt /tmp/active-config.json
python3 -m json.tool /tmp/active-config.json >/dev/nullIf you have pytest installed:
pytest -q