【问题标题】:Certificate / SSL connection problem in docker build on macOSmacOS 上 docker build 中的证书/SSL 连接问题
【发布时间】:2020-07-13 22:50:05
【问题描述】:

我正在 ma​​cOS 上构建 docker 映像。这是我的 Dockerfile 的一部分:

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 

当我构建图像时,它返回此错误:

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",它也会传递这个错误,但它会在 Dockerfile 的其余部分返回错误。

这意味着我的 macOS 版 Docker 存在 ssl 连接问题,我错过了 ma​​c 中 Docker 的 ssl 证书或其他 ssl 设置的配置吗?

【问题讨论】:

  • 在我的 macOS 机器上构建您的 docker 文件不会重现您描述的问题;使用标准 docker 安装,克隆对我来说很好。
  • 谢谢,对我来说,它不是从 git 克隆的。

标签: docker docker-compose ssl-certificate dockerfile docker-registry


【解决方案1】:

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

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

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

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

FROM ubuntu:18.04

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

在我的情况下,它是另一个基本图像,但行为/解决方案是相同的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-08-07
    • 1970-01-01
    • 2015-05-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-06
    相关资源
    最近更新 更多