Невозможно составить docker из-за прокси - PullRequest
1 голос
/ 19 июня 2020

Я пытаюсь использовать docker-compose build за корпоративным прокси-сервером, но по какой-то причине ни одна из областей, в которые вы вставляете настройки прокси-сервера, похоже, не позволяет ему выполнить шаги.

Я использую CentOS 8.

Сообщение об ошибке:

[root@centos8server docker]# docker-compose build
    postgres uses an image, skipping
    start_dependencies uses an image, skipping
    Building custom-docker

    Step 1/15 : FROM swift:5.2.3 as builder
    ---> 67a9c8f156c1

    Step 2/15 : ARG env
    ---> Using cache
    ---> b767ab90fbe8

    Step 3/15 : RUN apt-get -qq update && apt-get install -y   libssl-dev zlib1g-dev   && rm -r /var/lib/apt/lists/*
    ---> Running in b935c12d0bbd
    W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease  Temporary failure resolving 'archive.ubuntu.com'
    W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
    W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
    W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
    W: Some index files failed to download. They have been ignored, or old ones used instead.

    Reading package lists...
    Building dependency tree...
    Reading state information...
    E: Unable to locate package libssl-dev

    ERROR: Service 'custom-docker' failed to build: The command '/bin/sh -c apt-get -qq update && apt-get install -y   libssl-dev zlib1g-dev   && rm -r /var/lib/apt/lists/*' returned a non-zero code: 100

Моя первоначальная мысль заключалась в том, что сервер CentOS использовал apt и apt-get, которых не существует, но затем я построил сервер дома без ограничений прокси на нем просто работал. Я могу wget адреса, и у меня нет проблем с ними.

Я пробовал добавлять прокси в следующих областях:

1. прокси для сборки и компоновки

За исключением того, что у меня не было папки .docker ни в одной из учетных записей пользователей, поэтому я создал каталог и файл

nano ~/.docker/config.json
{
    "proxies": {
        "default": {
            "httpProxy": "http://proxy.server:port",
            "httpsProxy": "http://proxy.server:port",
            "noProxy": "localhost,127.0.0.1"
        }
    }
}

2. Прокси-сервер для среды

3. Прокси для sysconfig

Единственное, что я знаю, что было проблемой в прошлом, это наш прокси Basi c -Auth, но не смог найти как это добавить или нужно добавить.

1 Ответ

0 голосов
/ 21 июня 2020

Вам необходимо добавить настройки прокси в самом Dockerfile:

# above apt-get
ENV http_proxy http://user:password@proxy.domain.ltd:[PORT]
ENV https_proxy http://user:password@proxy.domain.ltd:[PORT]

# above git
# basic proxy auth if needed
RUN git config --global http.proxy http://user:password@proxy.domain.ltd:[PORT] && \
    git config --global https.proxy http://user:password@proxy.domain.ltd:[PORT] && \
    git config --global http.proxyAuthMethod 'basic' && \
    git config --global https.proxyAuthMethod 'basic'
...