我正在使用多步构建将动态链接的c程序与docker打包在一起,但是我缺少一个库或其他东西:
FROM debian:9.5-slim as builder
WORKDIR /openconnect
RUN apt update && apt install -y \
build-essential \
gettext \
autoconf \
automake \
libproxy-dev \
libxml2-dev \
libtool \
vpnc-scripts \
pkg-config \
libgnutls28-dev
ADD . .
RUN ./autogen.sh
RUN ./configure \
--with-vpnc-script=/etc/vpnc/vpnc-script \
--without-openssl-version-check
RUN make
RUN make install
RUN ldconfig
FROM builder as gatherer
RUN mkdir /gathered
RUN ldd /usr/local/sbin/openconnect | grep "=> /" | awk '{print $3}' | xargs -I '{}' sh -c "cp -v --parents {} /gathered"
RUN cp --parents /usr/local/sbin/openconnect /gathered
FROM debian:9-slim
COPY --from=gatherer /gathered /
ENTRYPOINT ["/usr/local/sbin/openconnect"]
我运行容器时得到:
/usr/local/sbin/openconnect: error while loading shared libraries: libopenconnect.so.5: cannot open shared object file: No such file or directory
我已验证最终映像中存在“ /usr/local/lib/libopenconnect.so.5”。另外,如果我跳过多级操作,那么容器运行就很好。
我想念什么?