docker build on macOS 中的证书/SSL 连接问题

Certificate / SSL connection problem in docker build on macOS

我正在 macOS 上构建一个 docker 图像。这是我的 Docker 文件的一部分:

FROM ubuntu:18.04

# Dir you need to override to keep data on reboot/new container:
VOLUME /var/lib/mysql
#VOLUME /var/www/MISP/Config

# Dir you might want to override in order to have custom ssl certs
# Need: "misp.key" and "misp.crt"
#VOLUME /etc/ssl/private

# 80/443 - MISP web server, 3306 - mysql, 6379 - redis, 50000 - MISP ZeroMQ
EXPOSE 80 443 3306 6379 50000

ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_PRIORITY critical
RUN apt-get update && apt-get install -y supervisor cron logrotate syslog-ng-core postfix curl gcc git gnupg-agent make python3 openssl redis-server sudo vim zip wget mariadb-client mariadb-server sqlite3 moreutils apache2 apache2-doc apache2-utils libapache2-mod-php php php-cli php-gnupg php-dev php-json php-mysql php7.2-opcache php-readline php-redis php-xml php-mbstring rng-tools python3-dev python3-pip python3-yara python3-redis python3-zmq libxml2-dev libxslt1-dev zlib1g-dev python3-setuptools libpq5 libjpeg-dev libfuzzy-dev ruby asciidoctor tesseract-ocr imagemagick libpoppler-cpp-dev



RUN mkdir -p /var/www/MISP /root/.config /root/.git


WORKDIR /var/www/MISP
RUN chown -R www-data:www-data /var/www/MISP /root/.config /root/.git
RUN sudo -u www-data -H git clone https://github.com/MISP/MISP.git /var/www/MISP 

当我构建图像时,它 returns 这个错误:

Step 16/16 : RUN sudo -u www-data -H git clone https://github.com/MISP/MISP.git /var/www/MISP
 ---> Running in f0f0b76b353c
Cloning into '/var/www/MISP'...
fatal: unable to access 'https://github.com/MISP/MISP.git/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none

找不到证书。即使我添加 RUN git config --global http.sslverify "false" 它也会传递此错误,但它会在 Docker 文件的其余部分中出现 returns 错误。

这意味着我的 Docker 用于 macOS 的 ssl 连接有问题,Docker 中的 ssl 证书或其他 ssl 设置是否有任何配置? =22=]mac 我错过了?

我 运行 遇到了同样的问题。完全相同的错误信息。

这里你必须意识到的是,你正在运行ning的git命令是在docker环境中的,与你在MacOS,或您在操作系统中安装的 git 版本。

这里发生的事情是普通 ubuntu:18.04 图像已经过时并且没有最新的证书。

就我而言,我通过在 FROM 行之后添加以下两个语句来解决此问题:

FROM ubuntu:18.04

# Update the OS
RUN apt-get update && apt-get upgrade -y

在我的例子中,它是另一个基本图像,但 behavior/solution 是相同的。