在一个 ubuntu 容器内,换源,安装和运行( ifconfig, ps,ping)
要修改容器内的ubuntu 的源, (假设该容器名称为 ubuntu01 )步骤如下:
- 进入容器
docker exec -it ubuntu01 /bin/bash - 修改源, 运行如下命令
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
EOF - 安装软件 (ifconfig, ps, ping这些命令)
apt-get clean
apt-get autoremove --purge
apt update
apt -y install net-tools procps iputils-pingnet-tools :为了使用ifconfig
procps:为了使用ps
iputils-ping:为了使用ping
浙公网安备 33010602011771号