teddysun / across

Across the Great Wall we can reach every corner in the world
https://teddysun.com
Apache License 2.0
4.97k stars 2.22k forks source link

阿里云ecs使用docker构建vpn无法找到环境文件 #55

Closed Hecbi closed 4 years ago

Hecbi commented 4 years ago

启动命令 docker run -d --privileged -p 500:500/udp -p 4500:4500/udp --env-file=/tmp/l2tp.env -v /lib/modules:/lib/modules teddysun/l2t p

/tmp/l2tp.env 文件内容

PSEC_PSK=teddysun.com
VPN_USER=bahangtu
VPN_PASSWORD=vpnpassword
VPN_PUBLIC_IP=
VPN_L2TP_NET=
VPN_L2TP_LOCAL=
VPN_L2TP_REMOTE=
VPN_XAUTH_NET=
VPN_XAUTH_REMOTE=
VPN_DNS1=
VPN_DNS2=
VPN_SHA2_TRUNCBUG=

接下来无法启动

root@iZ2ze72ujoo5ubiog2nr4rZ:~# docker run -d --privileged -p 500:500/udp -p 4500:4500/udp --env-file=/tmp/l2tp.env -v /lib/modules:/lib/modules teddysun/l2t
p
a38d4976e712e9528eb71696868967a7e38817f130c9602a2da27aa07d99408a
root@iZ2ze72ujoo5ubiog2nr4rZ:~# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
root@iZ2ze72ujoo5ubiog2nr4rZ:~# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS                          PORTS               NAMES
a38d4976e712        teddysun/l2tp       "l2tp"              5 seconds ago        Exited (1) 4 seconds ago                            stupefied_williamson
root@iZ2ze72ujoo5ubiog2nr4rZ:~# docker logs a38d4976e712
Error: Environment variables must be specified. please edit your environment file and retry again.
Hecbi commented 4 years ago
root@iZ2ze72ujoo5ubiog2nr4rZ:~# docker -v
Docker version 18.09.7, build 2d0083d
teddysun commented 4 years ago

升级 Docker 到最新版 19.03.5 后重试看看。

Hecbi commented 4 years ago

问题依旧存在

root@iZ2ze72ujoo5ubiog2nr4rZ:~# docker run -d --privileged -p 500:500/udp -p 4500:4500/udp --name l2tp --restart=always --env-file /etc/l2tp.env -v /lib/modules:/lib/modules teddysun/l2tp
16ea7a7da135bd3ad1039478e1a98e7651a6508b5dd069d1796a2b55391f11a3
root@iZ2ze72ujoo5ubiog2nr4rZ:~# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                                  PORTS               NAMES
16ea7a7da135        teddysun/l2tp       "l2tp"              2 seconds ago       Restarting (1) Less than a second ago                       l2tp
root@iZ2ze72ujoo5ubiog2nr4rZ:~# docker logs 16ea7a7da135
Error: Environment variables must be specified. please edit your environment file and retry again.
Error: Environment variables must be specified. please edit your environment file and retry again.
Error: Environment variables must be specified. please edit your environment file and retry again.
Error: Environment variables must be specified. please edit your environment file and retry again.
Error: Environment variables must be specified. please edit your environment file and retry again.
Error: Environment variables must be specified. please edit your environment file and retry again.
Error: Environment variables must be specified. please edit your environment file and retry again.
root@iZ2ze72ujoo5ubiog2nr4rZ:~# docker -v
Docker version 19.03.5, build 633a0ea838
teddysun commented 4 years ago

报错信息显示是无法读取环境变量的配置文件,请确保 /etc/l2tp.env 的文件内容正确。以及该文件能在 Linux 下被正常读取。 如果你是在 Windows 系统里编辑后上传至VPS的,则需要修正换行符的问题。