头图

Nginx容器中安装软件或缺失工具的方式

基础环境

飞腾处理器+银河麒麟操作系统,Intel/AMD64+Windows/Linux系统

准备工作

准备工作:如果Nginx容器中没有的命令,需要安装,需要一些操作(其使用debian服务)

docker run --name mynginx -it nginx /bin/bash

一、尝试更新源

echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian stretch main contrib non-free" > /etc/apt/sources.list
echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian stretch-updates main contrib non-free" >> /etc/apt/sources.list
echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian-security stretch/updates main contrib non-free" >> /etc/apt/sources.list
apt update

如果失败,可能nginx使用的debian9已失败。需要切换至归档源

二、切换至支持9的归档源(推荐)

echo "deb http://archive.debian.org/debian stretch main contrib non-free" > /etc/apt/sources.list
echo "deb http://archive.debian.org/debian-security stretch/updates main contrib non-free" >> /etc/apt/sources.list
echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid-until
apt update

三、也可以选择升级至10

cho "deb http://mirrors.tuna.tsinghua.edu.cn/debian buster main contrib non-free" > /etc/apt/sources.list
echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free" >> /etc/apt/sources.list
apt update && apt upgrade -y

作者:码上世界 1179611323@qq.com

发行日志

20250519 初版


码上世界
90 声望302 粉丝

码农极客,2004年接触Linux世界。爱技术的IT的男