[GH-ISSUE #314] 自定义的vpn.env无效 #292

Closed
opened 2026-03-02 08:01:08 +03:00 by kerem · 1 comment
Owner

Originally created by @alsomail on GitHub (Oct 23, 2022).
Original GitHub issue: https://github.com/hwdsl2/docker-ipsec-vpn-server/issues/314

  1. 使用默认配置是可以正常使用的
  2. 使用环境变量添加vpn.env之后,提示“All VPN credentials must be specified. Edit your 'env' file and re-enter them.”
  3. 重现步骤:
    1. 根目录下创建文件 /vpn/vpn.env
    2. 添加账号密码
      VPN_IPSEC_PSK=your_ipsec_pre_shared_key VPN_USER=your_vpn_username VPN_PASSWORD=your_vpn_password
    3. 创建镜像
      docker run \ --name ipsec-vpn-server \ --env-file /vpn/vpn.env \ --restart=always \ -v ikev2-vpn-data:/etc/ipsec.d \ -v /lib/modules:/lib/modules:ro \ -p 500:500/udp \ -p 4500:4500/udp \ -d --privileged \ hwdsl2/ipsec-vpn-server

感觉是没有读取到vpn.env,但是如果直接复制vpn.env模板,又会检测异常
'docker: poorly formatted environment: variable 'te: All the variables to this image are optional.' contains whitespaces.
See 'docker run --help'.'

Originally created by @alsomail on GitHub (Oct 23, 2022). Original GitHub issue: https://github.com/hwdsl2/docker-ipsec-vpn-server/issues/314 1. 使用默认配置是可以正常使用的 2. 使用环境变量添加vpn.env之后,提示“All VPN credentials must be specified. Edit your 'env' file and re-enter them.” 3. 重现步骤: 1. 根目录下创建文件 /vpn/vpn.env 2. 添加账号密码 `VPN_IPSEC_PSK=your_ipsec_pre_shared_key VPN_USER=your_vpn_username VPN_PASSWORD=your_vpn_password` 3. 创建镜像 `docker run \ --name ipsec-vpn-server \ --env-file /vpn/vpn.env \ --restart=always \ -v ikev2-vpn-data:/etc/ipsec.d \ -v /lib/modules:/lib/modules:ro \ -p 500:500/udp \ -p 4500:4500/udp \ -d --privileged \ hwdsl2/ipsec-vpn-server` 感觉是没有读取到vpn.env,但是如果直接复制vpn.env模板,又会检测异常 'docker: poorly formatted environment: variable 'te: All the variables to this image are optional.' contains whitespaces. See 'docker run --help'.'
kerem closed this issue 2026-03-02 08:01:08 +03:00
Author
Owner

@alsomail commented on GitHub (Oct 23, 2022):

下午多试几次可以了……

<!-- gh-comment-id:1288011160 --> @alsomail commented on GitHub (Oct 23, 2022): 下午多试几次可以了……
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/docker-ipsec-vpn-server#292
No description provided.