Docker Ubuntu 18.04容器禁用网卡后无法恢复网络连接问题咨询
Docker Ubuntu 18.04容器禁用网卡后无法恢复网络连接问题咨询
大家好,我碰到一个挺头疼的Docker网络问题,想请教下有没有解决办法:
我有一个基于Ubuntu 18.04的Docker容器,启动命令是:
docker run --hostname=hello.world --cap-add=NET_ADMIN -it test-ubuntu18
在容器内部,我执行了ip link set eth0 down来临时禁用eth0网卡,之后再执行命令把网卡重新启用(比如ip link set eth0 up),虽然系统提示网卡已经处于up状态,但容器彻底失去了网络连接——不管ping外部地址还是做其他网络操作都完全没用了。
下面是我用来构建镜像的Dockerfile:
FROM ubuntu:18.04 as base # Install base dependencies RUN apt-get update && apt-get install -y -q --no-install-recommends \ apt-transport-https build-essential ca-certificates curl dbus git \ iputils-ping libssl-dev net-tools network-manager vim wget systemd \ sudo rsyslog ENV NVM_DIR /root/.nvm ENV NODE_VERSION 17 RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash \ && . $NVM_DIR/nvm.sh \ && nvm install $NODE_VERSION \ && nvm alias default $NODE_VERSIO...
有没有人遇到过类似的情况?或者能指点下该怎么排查和解决这个问题吗?
备注:内容来源于stack exchange,提问作者codenamezero
相关产品推荐
相关产品推荐

