Üdv!
Proxy mögött hogyan lehetne használni?
$ docker build --build-arg http_proxy="http://proxy_ip:3128" -t centos7:test .
Sending build context to Docker daemon 3.072 kB
Step 1/8 : FROM centos:7
Trying to pull repository docker.io/library/centos ...
Trying to pull repository registry.fedoraproject.org/centos ...
Trying to pull repository quay.io/centos ...
Trying to pull repository registry.access.redhat.com/centos ...
Csak vár-vár... ztán timeout.
A doksi szerinti beállítás szerint sem akar kimenni:
$ export HTTP_PROXY=http://10.20.30.2:1234
$ export HTTPS_PROXY=http://10.20.30.2:1234
$ docker build --build-arg HTTP_PROXY --build-arg HTTPS_PROXY -t centos7:test .
- 750 megtekintés
Hozzászólások
A docker systemd file-ba:
[Service]
...
Environment="HTTP_PROXY=http://proxy.example.com:3128/"
Már csak a konténer image-ben kellene a proxy a "RUN yum -y install ..."-hoz
A Dockerfile végén ott van:
ENV http_proxy http://proxy_ip:3128
ENV https_proxy http://proxy_ip:3128
De ezzel nem megy:
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=conta… error was
14: curl#7 - "Failed to connect to 2607:f8f8:700:12::10: Network is unreachable"
A Dockerfile-ban hogy kellene megadni?
- A hozzászóláshoz be kell jelentkezni
- A hozzászóláshoz be kell jelentkezni
Közben rájöttem. :)
Összegezve:
# /etc/systemd/system/multi-user.target.wants -> /usr/lib/systemd/system/docker.service
[Service]
...
Environment="HTTP_PROXY=http://proxy.example.com:3128/"
Environment="HTTPS_PROXY=http://proxy.example.com:3128/"
A Dockerfile fájlban már a RUN előtt elhelyezhető:
ENV http_proxy http://proxy.example.com:3128/
ENV https_proxy http://proxy.example.com:3128/
Szépen működik. :)
- A hozzászóláshoz be kell jelentkezni