lightweight futu opend docker
# default base image is ubuntu
docker pull ghcr.io/manhinhang/futu-opend-docker:ubuntu-stable| Base Image | Tags |
|---|---|
| ubuntu | ubuntu-stable |
| ubuntu | ubuntu-beta |
| ubuntu | ubuntu-{opend_version} |
| centos | centos-stable |
| centos | centos-beta |
| centos | centos-{opend_version} |
You need to create FutuOpenD.xml file generate your own RSA key
openssl genrsa -out futu.pem 1024
PEM file should config in XML
...
<rsa_private_key>/bin/futu.pem</rsa_private_key>
...docker run -it --name futu-opend-docker \
-v $(pwd)/FutuOpenD.xml:/bin/FutuOpenD.xml \
-v $(pwd)/futu.pem:/bin/futu.pem \
-p 11111:11111 \
-p 22222:22222 \
ghcr.io/manhinhang/futu-opend-dockerPort mappings:
11111: API port for FutuOpenD protocol22222: Telnet port for 2FA input (optional, but recommended for automation)
FutuOpenD may require two types of verification:
- SMS verification code - sent to your phone
- Picture CAPTCHA - downloaded to container
You can input verification codes using either docker attach or telnet:
- Attach to futu opend container
docker attach futu-opend- Input verification code based on the type:
For SMS verification code:
input_phone_verify_code -code=<SMS_CODE>For picture CAPTCHA:
First, copy the CAPTCHA image from container:
docker cp futu-opend:/home/futu/.com.futunn.FutuOpenD/F3CNN/PicVerifyCode.png ./PicVerifyCode.pngThen view the image and input the code:
input_pic_verify_code -code=<CAPTCHA_CODE>Connect to the FutuOpenD telnet port (22222) and send the command:
For SMS verification code:
# Interactive
telnet localhost 22222
input_phone_verify_code -code=<SMS_CODE>
# One-liner
echo "input_phone_verify_code -code=<SMS_CODE>" | telnet localhost 22222For picture CAPTCHA:
First, extract the CAPTCHA image:
docker cp futu-opend:/home/futu/.com.futunn.FutuOpenD/F3CNN/PicVerifyCode.png ./PicVerifyCode.pngThen input the code via telnet:
echo "input_pic_verify_code -code=<CAPTCHA_CODE>" | telnet localhost 22222Automation script example:
#!/bin/bash
# Auto-input SMS verification code
{
sleep 2
echo "input_phone_verify_code -code=$1"
sleep 1
} | telnet localhost 22222#!/bin/bash
# Auto-input picture CAPTCHA
# First extract and display the image, then input the code
docker cp futu-opend:/home/futu/.com.futunn.FutuOpenD/F3CNN/PicVerifyCode.png /tmp/PicVerifyCode.png
# Display image (choose your preferred viewer)
open /tmp/PicVerifyCode.png # macOS
# xdg-open /tmp/PicVerifyCode.png # Linux
# start /tmp/PicVerifyCode.png # Windows
read -p "Enter CAPTCHA code: " captcha_code
{
sleep 2
echo "input_pic_verify_code -code=$captcha_code"
sleep 1
} | telnet localhost 22222Edit .env
| Enviroment Variable | Description |
|---|---|
| FUTU_ACCOUNT_ID | Futu account ID |
| FUTU_ACCOUNT_PWD | Futu account password |
| FUTU_RSA_FILE_PATH | Futu RSA file path in container |
| FUTU_OPEND_IP | Futu OpenD IP in container |
| FUTU_OPEND_PORT | Futu OpenD API Port in container |
| FUTU_OPEND_TELNET_PORT | Futu OpenD Telnet Port (default: 22222) |
docker compose up -dThe container includes a healthcheck that monitors the FutuOpenD API port:
| Setting | Value | Description |
|---|---|---|
| test | </dev/tcp/127.0.0.1/11111 |
TCP connection test to API port |
| interval | 60s | Check every 60 seconds |
| timeout | 10s | Timeout for each check |
| retries | 5 | Mark unhealthy after 5 failures |
| start_period | 120s | Grace period for container startup |
Check container health status:
docker ps --format "table {{.Names}}\t{{.Status}}"Then enter verification codes when prompted:
Using docker attach:
docker attach futu-opend
# For SMS verification
input_phone_verify_code -code=<SMS_CODE>
# For picture CAPTCHA (extract image first)
docker cp futu-opend:/home/futu/.com.futunn.FutuOpenD/F3CNN/PicVerifyCode.png ./PicVerifyCode.png
input_pic_verify_code -code=<CAPTCHA_CODE>Using telnet (see Input verification codes section for full details):
# For SMS verification
echo "input_phone_verify_code -code=<SMS_CODE>" | telnet localhost 22222
# For picture CAPTCHA
docker cp futu-opend:/home/futu/.com.futunn.FutuOpenD/F3CNN/PicVerifyCode.png ./PicVerifyCode.png
echo "input_pic_verify_code -code=<CAPTCHA_CODE>" | telnet localhost 22222Note: Ubuntu builds require version 9.4.x or later with Ubuntu 18.04 base image. Ubuntu 16.04 builds are no longer provided by Futu.
- Use ubuntu as base image
docker build -t futu-opend-docker --build-arg FUTU_OPEND_VER=10.0.6008 --build-arg BASE_IMG=ubuntu .- Use centos as base image
docker build -t futu-opend-docker --build-arg FUTU_OPEND_VER=10.0.6008 --build-arg BASE_IMG=centos .If you encounter download failures during build:
- Network issues: The download script includes automatic retry logic (3 attempts)
- Version compatibility: Ensure you're using a version that has Ubuntu 18.04 builds (9.4.x or later)
- Check available versions: Visit Futu OpenD download page
If the container fails to start:
- RSA key: Ensure
futu.pemexists and is properly mounted - Config file: Verify
FutuOpenD.xmlis valid XML - Verification required: First run may require verification codes
FutuOpenD may prompt for two types of verification:
-
SMS verification code (
input_phone_verify_code)- Sent to your registered phone number
- Input via docker attach or telnet
-
Picture CAPTCHA (
input_pic_verify_code)- Downloaded to
/home/futu/.com.futunn.FutuOpenD/F3CNN/PicVerifyCode.pnginside container - Extract with:
docker cp futu-opend:/home/futu/.com.futunn.FutuOpenD/F3CNN/PicVerifyCode.png ./PicVerifyCode.png - View the image and input the code
- Downloaded to
Tip: Use telnet method for automation - see Input verification codes section for details.
This project is not affiliated with Futu Securities International (Hong Kong) Limited.
Good luck and enjoy.