Docker容器中安装curl、telnet、vim基础工具

#因在容器中排查故障需要,安装基础工具

# 查看系统版本: cat /etc/os-release

Debian基础镜像
#先添加163源

# 新版本源(更新)
tee /etc/apt/sources.list << EOF
deb http://mirrors.163.com/debian/ buster main non-free contrib
deb http://mirrors.163.com/debian/ buster-updates main non-free contrib
deb http://mirrors.163.com/debian/ buster-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ buster main non-free contrib
deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contri
EOF

# 出处 https://www.cnblogs.com/liucx

#安装 curl telnet
apt-get update && apt-get install -y curl telnet vim

 

Alpine基础镜像

#先添加阿里源
cat > /etc/apk/repositories << EOF
http://mirrors.aliyun.com/alpine/v3.12/main/
http://mirrors.aliyun.com/alpine/v3.12/community
EOF
#安装 curl scp telnet vim
apk update && apk add curl openssh-client busybox-extras vim

 

Ubuntu基础镜像
# 添加阿里云源
cp /etc/apt/sources.list /etc/apt/sources.list.bak
cat > /etc/apt/sources.list <<EOF
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
EOF

# 更新
apt-get update
# 安装
apt install ntpdate tcpdump telnet traceroute lrzsz unzip zip

 

posted @ 2020-06-30 15:04  Mr'liu  阅读(12788)  评论(0编辑  收藏  举报