Closed hongyi-zhao closed 3 years ago
I really can't help you with this.
I got the reason for the proxy failure problem observed in bridge network mode. It's due that I only allowed the source network address of 172.17.0.1 instead of the whole 72.17.0.0/16 subnet in my haproxy's config file. Obviously, for the host network mode, the container will use the docker0 interface directly, while for bridge network mode, the container will use a virtual interface attached on the bridge assigned with an IP address belong to 72.17.0.0/16 subnet using 172.17.0.1 as the gateway.
For the missing gateway problem of bridge network, it appears upon the system's startup. So, I think this maybe a bug of docker. But anyway, it doesn't affect the normal use of the proxy in containers working with both host and bridge network modes.
Just a thought:
deepin desktop is started with --init=systemd
and --security-opt seccomp=unconfined
.
Maybe systemd somehow revokes the IP adress on container shutdown. It should not be able to do so (I think), but maybe it does. --security-opt seccomp=unconfined
might allow this.
You could compare with other desktop/systemd images if they break the IP adress, too. Try:
x11docker --desktop --init=systemd x11docker/lxde
x11docker --desktop --init=systemd -- --security-opt seccomp=unconfined -- x11docker/lxde
I find the absent gateway problem of bridge network exists upon the system's startup and has nothing to do with x11doker on one of my Ubuntu box, while on another Ubuntu machine, this problem doesn't appear. So, it presumably is a problem caused by the confliction among the installed software packages.
Closing here because it is not an x11docker or deepin issue.
Run x11docker in desktop mode as below will trigger the problem:
$ x11docker --sudouser -c --desktop --init=systemd -- --cap-add=IPC_LOCK --security-opt seccomp=unconfined -- hongyi-zhao/deepin-wine startdde
The hongyi-zhao/deepin-wine image is created by the following command with this Dockerfile:
$ docker build --network host -f Dockerfiles/deepin-wine . -t hongyi-zhao/deepin-wine
See my detailed notes in the above Dockerfile for more info.
For this case, even I add the correct IP address to docker0 interface again as below, the proxy listening on 172.17.0.1 still can't be accessed from within docker container, but it can be accessed from the host:
If running with --hostnet option, the proxy will be available both from host and container, i.e., like the following:
$ x11docker --sudouser -c --hostnet --desktop --init=systemd -- --cap-add=IPC_LOCK --security-opt seccomp=unconfined -- hongyi-zhao/deepin-wine startdde
In this case, all the following proxies are accessible from within container/host:
This maybe a bug of docker itself. Anyway, currently, the following method can be used as an expediency:
But this method can't solve the missing gateway problem of bridge network as shown below:
I want to know whether there are some methods for me to revise/add gateway to the bridge without restarting the docker service like the following:
$ sudo systemctl restart docker
Regards, HY