zhblue / hustoj

Popular Open Source Online Judge based on PHP/C++/MySQL/Linux for ACM/ICPC and NOIP training, with easy installation. 开源OJ系统
http://www.hustoj.com/?cat=2
GNU General Public License v2.0
3.25k stars 767 forks source link

docker: Error response from daemon: cannot share the host's network namespace when user namespaces are enabled #991

Closed AnitaLiu98 closed 6 months ago

AnitaLiu98 commented 6 months ago

描述问题 ubuntu:20.04 不开启docker可以正常运行,但是因为要用到python,所以希望在docker里运行,这样更安全。

执行bash docker.sh之后报错: docker: Error response from daemon: cannot share the host's network namespace when user namespaces are enabled. See 'docker run --help'.

systemctl restart docker: System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down

service docker status: docker: unrecognized service

似乎无法重启docker

AnitaLiu98 commented 6 months ago

执行dockerd --bip 192.168.0.1/24 结果如下: INFO[2024-03-06T15:55:06.700780034Z] Starting up
failed to load listeners: can't create unix socket /var/run/docker.sock: device or resource busy

执行dockerd --bip 192.168.0.1/24 -H unix:///var/run/custom_docker.sock 结果如下: ......略...... INFO[2024-03-06T15:55:49.799120169Z] containerd successfully booted in 0.013468s
INFO[2024-03-06T15:55:49.810807811Z] stopping healthcheck following graceful shutdown module=libcontainerd INFO[2024-03-06T15:55:49.810835565Z] stopping event stream following graceful shutdown error="context canceled" module=libcontainerd namespace=plugins.moby failed to start daemon: Devices cgroup isn't mounted failed to start daemon: Devices cgroup isn't mounted

zhblue commented 6 months ago

20.04 的仓库里所带的docker版本已经比较老,建议尝试搜索“Ubuntu 安装最新版docker

AnitaLiu98 commented 6 months ago

感谢,安装了最新版本但还是会遇到一些问题,暂时先用非docker环境跑了。 另外想问一下,如果不用docker,把python_free设成0,是不是python就无法判题了?

zhblue commented 6 months ago

是,建议手动替换更新最新版install目录的Dockerfile和docker.sh这两个文件,再试试。