在 alpine linux 下构建 openvpn 时如何解决错误 "unrecognized options: --enable-password-save"?

How do I resolve the error "unrecognized options: --enable-password-save" when building openvpn under alpine linux?

我正在基于标准 node-alpine 图像的 Docker 容器中构建自定义 openvpn 客户端。

(修剪后的)docker 图像看起来像:

FROM node:8.4-alpine
MAINTAINER: Dave <redacted@redacted.redacted>

RUN apk add --update --no-cache \
    file \
    make \
    gcc \
    g++ \
    python \
    wget

# install openVPN

RUN wget https://swupdate.openvpn.org/community/releases/openvpn-2.4.3.tar.gz --no-check-certificate
RUN gunzip openvpn-2.4.3.tar.gz
RUN tar -xvf openvpn-2.4.3.tar

WORKDIR openvpn-2.4.3
RUN ./configure --enable-password-save
RUN make
RUN make install

# ... the rest of the file

构建时出现错误

configure: WARNING: unrecognized options: --enable-password-save

然后检查会继续一段时间,然后在

失败
checking whether TUNSETPERSIST is declared... no
configure: error: no tap header could be found

我错过了什么?

您收到的警告与配置脚本中的错误无关。

警告只是表示您传递的标志无效,而错误表示您在构建路径中缺少依赖项。

在此特定情况下,您缺少 tap header。您需要安装 linux-headers 软件包。

顺便说一下,您还缺少一些其他的 openVPN 构建依赖项:

  • openssl-dev
  • lzo-dev
  • linux-pam-dev

总而言之,您需要按如下方式编辑 Dockerfile 的第三条命令:

RUN apk add --update --no-cache \
    file \
    make \
    gcc \
    g++ \
    python \
    wget \
    linux-headers \
    openssl-dev \
    lzo-dev \
    linux-pam-dev

你应该可以开始了