【发布时间】:2021-10-14 19:35:02
【问题描述】:
我正在尝试使用 git-ftp 创建 Docker 映像,以便可以部署到 sftp 服务器。
git-ftp 需要 git 和 curl 用 libssh2 编译,通常不包括在内,所以我从 curl 开发者那里找到了一个带有 sftp 支持的 Docker 映像:
% docker run --rm curlimages/curl:7.79.1 --version
curl 7.79.1-DEV (x86_64-pc-linux-musl) libcurl/7.79.1-DEV OpenSSL/1.1.1l zlib/1.2.11 brotli/1.0.9 libssh2/1.9.0 nghttp2/1.43.0
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s
rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM
NTLM_WB SSL TLS-SRP UnixSockets
但是,在我的 Dockerfile 中使用它作为基础镜像,在安装 git 之后我失去了 sftp 支持:
FROM curlimages/curl:7.79.1
USER root
RUN apk add --no-cache bash git
RUN git clone https://github.com/git-ftp/git-ftp.git
USER curl_user
WORKDIR /git-ftp
ENTRYPOINT ./git-ftp push --user $FTP_USER --passwd $FTP_PASSWORD $FTP_HOST
% docker run --env FTP_USER=user --env FTP_PASSWORD=password --env FTP_HOST=sftp://localhost:22 git-ftp
fatal: Protocol 'sftp' not supported by curl, exiting...
以ENTRYPOINT 作为curl --version 运行给了我以下信息:
curl 7.79.1-DEV (x86_64-pc-linux-musl) libcurl/7.79.1 OpenSSL/1.1.1l zlib/1.2.11 brotli/1.0.9 nghttp2/1.43.0
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM
NTLM_WB SSL TLS-SRP UnixSockets
WARNING: curl and libcurl versions do not match. Functionality may be affected.
所以,突然间,在安装 git 后,我失去了 sftp 支持,这是我使用此基础映像的唯一原因。
发生了什么事?我该如何解决这个问题?
【问题讨论】:
标签: git docker curl dockerfile sftp