Docker-compose不解析变量
来自三线的随记
If you're trying to pass those variables into the container, you need to escape them in the command using an extra $
[root@test]# vim docker-compose.yml version: '2' services: v2ray: image: ephz3nt/v2ray_v3:go restart: always network_mode: "host" command: - /bin/sh - -c - | sed -i "s|\"info\"|\"debug\"|" "/etc/v2ray/config.json" && sed -i "s|\"port\": 2333,|\"port\": $${api_port}, |" "/etc/v2ray/config.json" && sed -i "s|\"https://google.com\"|\"$${sspanel_url}\"|g" "/etc /v2ray/config.json" && sed -i "s/\"55fUxDGFzH3n\"/\"$${key}\"/g" "/etc/v2ray/config.json" && sed -i "s/123456/$${node_id}/g" "/etc/v2ray/config.json" && sed -i "s/\"SpeedTestCheckRate\": 6/\"SpeedTestCheckRate \": $${speedtest}/g" "/etc/v2ray/config.json" && sed -i "s/\"downWithPanel\": 6/\"downWithPanel\": $${downWithPanel}/g" "/etc/v2ray/config.json" && v2ray -config=/etc/v2ray/config.json