Solve the problem that apt-get uqdate is too slow

Solve the problem that apt-get uqdate is too slow

In the Dockerfile file, we can see this line of code

RUN apt-get update && \
  apt-get install -q -y default-jdk

During the deployment process, we found that when this code was executed, the speed became particularly slow, so we used the following method to solve the problem of too slow speed.

We have added these lines of code in front of the code, they are used to configure the source

ADD sources.list /etc/apt/
RUN  apt-get clean
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
RUN apt-get update && \
  apt-get install -q -y default-jdk

After completing the previous step, we need to create a sources.list file in the project directory and write the following lines of code.

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

The above is Aliyuan.

Guess you like

Origin blog.csdn.net/weixin_43372169/article/details/110200946