在服务器上的docker

编程入门 行业动态 更新时间:2024-10-14 16:21:29
本文介绍了在服务器上的docker-compose上使用代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当我运行 sudo docker-compose build 我得到

Building web Step 1/8 : FROM python:3.7-alpine ERROR: Service 'web' failed to build: error parsing HTTP 403 response body: invalid character '<' looking for beginning of value: "<html><body><h1>403 Forbidden</h1>\nSince Docker is a US company, we must comply with US export control regulations. In an effort to comply with these, we now block all IP addresses that are located in Cuba, Iran, North Korea, Republic of Crimea, Sudan, and Syria. If you are not in one of these cities, countries, or regions and are blocked, please reach out to support.docker\n</body></html>\n\n"

我需要为 docker-compose 设置代理以构建

I need to set proxy for docker-compose for build

我尝试过的事情:

查看 https ://docs.docker/network/proxy/#configure-the-docker-client

  • 我尝试设置〜/ .docker / config.json

{ "proxies": { "default": { "httpProxy": "127.0.0.1:9278" } } }

  • 尝试过 --env 参数

    尝试在服务器上设置代理变量,但没有结果

    tried setting proxy variables on the server with no result

    我也尝试过此链接

    services: myservice: build: context: . args: - http_proxy - https_proxy - no_proxy

    但是我在 version上得到了这个:'3.6'

    Unsupported config option for services.web: 'args'

  • 这些设置似乎是在docker上设置的,而不是在docker-compose

    these settings seem to be set on docker and not docker-compose

    我也不需要在我的本地设备上设置任何代理(我不想

    i also don't need to set any proxy on my local device (i don't want to loose portability if possible)

    docker-compose version 1.23.1, build b02f1306 Docker version 18.06.1-ce, build e68fc7a

    推荐答案

    您必须来自伊朗被docker禁止(来自 403 状态代码)。通过编辑``:

    You must be from Iran which is banned by docker (from 403 status code). add http proxy env to you docker service by editing ``:

    [Service] Environment = HTTP_PROXY = http:// proxy.example:80/ HTTPS_PROXY = http://proxy.example:80 /

    之后,您应该发出:

    $ systemctl daemon-reload $ systemctl restart docker

    更多推荐

    在服务器上的docker

    本文发布于:2023-10-27 10:32:18,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1533110.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:器上   docker

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!