1. docker run命令(新手推荐)直接复制到ssh执行
1 2 3 4 5 6 7 8 9
| docker run -d \ --name jd_autologin \ --restart unless-stopped \ -p 12345:12345 \ -e TZ=Asia/Shanghai \ -v /your/host/app/directory:/app \ python:3.12.4 \ sh -c "apt -y update && apt -y install libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libdbus-1-3 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 libasound2 libatspi2.0-0 libxshmfence1 && python -m pip install --upgrade pip && pip install pyppeteer Pillow asyncio aiohttp opencv-python-headless ddddocr quart && rm -rf && wget -O api.py https://raw.githubusercontent.com/zhao-zg/jd-login/main/api.py && wget -O login.py https://raw.githubusercontent.com/zhao-zg/jd-login/main/login.py && python api.py"
|
2. docker-compose方式安装
创建docker-compose.yml文件,把下面代码放进去
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| version: "3" services: jd_autologin: image: python:3.12.4 container_name: jd_autologin restart: unless-stopped ports: - 12345:12345 working_dir: /app environment: TZ: Asia/Shanghai command: > sh -c "apt -y update && apt -y install libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libdbus-1-3 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 libasound2 libatspi2.0-0 libxshmfence1 && python -m pip install --upgrade pip && pip install pyppeteer Pillow asyncio aiohttp opencv-python-headless ddddocr quart && rm -rf && wget -O api.py https://raw.githubusercontent.com/zhao-zg/jd-login/main/api.py && wget -O login.py https://raw.githubusercontent.com/zhao-zg/jd-login/main/login.py && python api.py" networks: {}
|