【问题标题】:docker-compose build and http_proxydocker-compose build 和 http_proxy
【发布时间】:2016-01-25 10:36:38
【问题描述】:

我想测试 ELK。 它工作正常 但是当我想做一个

docker-compose up

在代理之后

docker-compose up --no-recreate 
Building kibana
Step 1 : FROM kibana:latest
 ---> 544887fbfa30
Step 2 : RUN apt-get update && apt-get install -y netcat
 ---> Running in 794342b9d807

失败了

W: Some index files failed to download. They have been ignored, or old ones used instead.

没关系

docker build  --build-arg  http_proxy=http://proxy:3128  --build-arg https_proxy=http://proxy:3128 kibana

但是当我重做一个 docker-compose up 时,我尝试重新构建,并且无法通过代理

有什么帮助吗?

【问题讨论】:

    标签: elasticsearch proxy docker


    【解决方案1】:

    您需要docker-compose 1.6.0-rc1 才能通过 docker-compose 将代理传递给您的构建。
    请参阅 commit 47e53b4PR 2653issue 2163

    将所有与构建相关的配置移动到服务中的build: 部分。
    示例:

    web:
      build:
        context: .
        dockerfile: Dockerfile.name
        args:
           key: value
    

    正如mkjeldsen 指出的in the comments

    如果key 应该采用同名的环境变量的值,则可以省略value (docker-compose ARGS):

    https_proxy 尤其有用:如果envvar 未设置或为空,则构建器将不会应用代理,否则会。

    【讨论】:

    • 如果key 应该假定同名环境变量的值,value 可以省略:docs.docker.com/compose/compose-file/#args。对https_proxy 尤其有用:如果 envvar 未设置或为空,则构建器不会应用代理,否则会。
    • @mkjeldsen 谢谢。我已将您的评论包含在答案中以提高知名度。
    【解决方案2】:

    我遇到了同样的问题。帮助我的是使用显式版本 2.2,然后按照the documentation 中的描述构建 - args 和 - 网络。

    【讨论】:

      【解决方案3】:

      你在干净的机器上试过了吗?

      docker-machine stop default
      docker-machine create -d virtualbox test
      docker-machine start test
      eval $(docker-machine env test)
      docker-compose up
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-10-18
        • 2019-07-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-01-19
        • 2020-12-23
        • 2019-10-10
        相关资源
        最近更新 更多