更新时间:2023-12-04 09:33:52
也许您可以采用不同的方法来解决此问题.例如.通过环境变量将所需的信息从主机传递到容器.
Maybe you can approach this problem different way. Eg. pass information you need from host to container via environment variables.
docker run -e HOST_MAC=$(ifconfig -a | grep -Po 'HWaddr \K.*$') image
这需要您更改容器的运行方式,但这可能是解决此问题的最干净的方法.
This requires you to change how you run a container, however it's probably the cleanest method of solving this.