docker工具箱docker build后面的代理在Windows

时间:2016-06-15 14:24:58

标签: docker dockerfile

Windows中已安装的docker工具箱。 配置好一切。

我们有公司代理。 因此,要配置代理,请执行以下操作。 添加了环境变量。

set HTTP_PROXY=xx.xx.xx.xx:10015 
set HTTPS_PROXY=xx.xx.xx.xx:10015 
set NO_PROXY=192.168.99.100

然后使用以下命令

创建新虚拟机
docker-machine create -d virtualbox --engine-env HTTP_PROXY=xx.xx.xx.xx:10015 --engine-env HTTPS_PROXY=xx.xx.xx.xx:10015 --engine-env NO_PROXY=192.168.99.100 default

尝试使用以下命令构建docker镜像

docker build -t 1234567890.dkr.ecr.us-east-1.amazonaws.com/my-repository .

这里我有docker文件,其命令如下

FROM centos:latest

MAINTAINER me - ./build_centos.sh

# Set correct environment variables.
ENV HOME /root
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8

RUN yum install -y curl; yum upgrade -y; yum update -y;  yum clean all
RUN yum -y update && yum -y install wget && yum -y install tar 
RUN yum install -y wget unzip

RUN curl --insecure --junk-session-cookies --location --remote-name --silent --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u66-b17/jdk-8u66-linux-x64.rpm
RUN yum localinstall -y jdk-8u66-linux-x64.rpm
RUN rm jdk-8u66-linux-x64.rpm

ENV JAVA_HOME /usr/java/default

# RUN yum remove curl;  yum clean all
# centos-java8U60-ssh
RUN yum -y install openssh-server initscripts 
RUN echo "root:xxxxx" | chpasswd 
RUN /usr/sbin/sshd-keygen 
EXPOSE 22  
CMD ["/usr/sbin/sshd", "-D"] 

RUN mkdir /opt/myimage
COPY myjara-repository-0.0.1.jar /opt/myimage

WORKDIR /opt/myimage

EXPOSE 8091 
CMD java -jar myimage-repository-0.0.1.jar

但我收到了以下错误

Cannot find a valid baseurl for repo: base/7/x86_64
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#7 - "Failed to connect to 2a01:c0:2:4:0:acff:fe1e:1e52: Network is unreachable"
The command '/bin/sh -c yum -y update && yum -y install wget && yum -y install tar' returned a non-zero code: 1

如何解决这个问题?

0 个答案:

没有答案