Foreword
We pull the image from the DockerHub, create a container in order to achieve a variety of functions. However, because most of the Docker image is the default of foreign source software, download the update very slow, Docker article describes how to change the software source container.
Explanation
Change Docker container source software similar to most of the steps with a separate Linux system.
Steps:
- Backup configuration files;
- Select the country corresponding to the source;
- Edit the configuration file;
- Update software source.
The only difference is the "Edit Profile" step:
-
Docker container is not loaded by default text editor, you can not edit the configuration file directly.
Including vi, vim, nano, etc. are not installed.
Using shell redirection
We can redirect the output file functions provided by the shell.
- shell redirection specific use, please read: rookie tutorial Shell input / output redirection .
Use echo call redirection
Command frame as follows:
echo -e "xxxxxxx\nxxxxxxx" >> sources.list
-
"Echo": output string;
-
"-E": open escaped.
The absence of this option, "\ n" output by character, not wrapped.
-
"" Xxxxxxx \ nxxxxxxx "": in double quotes comprising a mirror to be replaced source information, "\ n" newline;
-
">>": Redirect;
-
"Sources.list": file to redirect output.
We debian, for example, using a specific command.
echo -e "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free\ndeb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free\ndeb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free\ndeb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free" >> sources.list
Then apt update
update the software source can be.