附上最终的Dockerfile:
#OS: Centos
#Version: centos7.6
#Author: local.prop
FROM docker.io/centos:centos7.6.1810
ENV http_proxy=xxx.xxx.xxx:8888
ENV https_proxy=xxx.xxx.xxx:8888
#ENV APT_PROXY=Acquire::http::proxy\ \"http://xxx.xxx.xxx:8888\"\;\nAcquire::https::proxy\ \"https://xxx.xxx.xxx:8888\"\;
ENV WGET_HTTP_PROXY="http_proxy = xxx.xxx.xxx:8888"
ENV WGET_HTTPS_PROXY="https_proxy = xxx.xxx.xxx:8888"
RUN export http_proxy=$http_proxy
RUN export https_proxy=$https_proxy
RUN echo 'proxy=http://xxx.xxx.xxx:8888'>>/etc/yum.conf
RUN echo '[http_proxy]'>/root/.hgrc && echo 'xxx.xxx.xxx:8888'>>/root/.hgrc
#RUN echo $APT_PROXY > /etc/apt/apt.conf
########## install project packages ##########
RUN yum groupinstall -y "Development tools"
RUN yum update -y && yum groupinstall -y "Development tools" && yum install -y \
wget \
vim \
bzip2 \
gcc \
make \
glibc-devel.i686 \
libgcc.i686 \
gcc-c++ \
cmake
RUN echo 'use_proxy=yes' > /etc/wgetrc && echo 'http_proxy=http://xxx.xxx.xxx:8888' >> /etc/wgetrc
WORKDIR /root/source
RUN wget http://ftp.gnu.org/gnu/gcc/gcc-6.5.0/gcc-6.5.0.tar.gz && \
tar -zvxf gcc-6.5.0.tar.gz --remove-files && cd gcc-6.5.0 && \
sed -i 's/ftp:\/\/gcc.gnu.org\/pub\/gcc\/infrastructure/http:\/\/mirror.linux-ia64.org\/gnu\/gcc\/infrastructure/g' contrib/download_prerequisites && \
./contrib/download_prerequisites && \
./configure --disable-multilib && \
make -j`nproc` && \
make install -j`nproc` && \
cd .. && \
rm -rf gcc-6.5.0
#RUN wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz && \
#tar xf yasm-1.3.0.tar.gz --remove-files && \
#cd yasm-1.3.0 && \
#./configure && \
#make -j`nproc` && \
#make install && \
#cd .. && \
#rm -rf yasm*
WORKDIR /root