Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux docker entrypoint.sh没有root用户的权限_Linux_Bash_Docker - Fatal编程技术网

Linux docker entrypoint.sh没有root用户的权限

Linux docker entrypoint.sh没有root用户的权限,linux,bash,docker,Linux,Bash,Docker,Dockerfile FROM ubuntu:18.04 ADD entrypoint.sh /usr/local/bin/ RUN chown root:root /usr/local/bin/entrypoint.sh RUN chmod 4755 /usr/local/bin/entrypoint.sh ENTRYPOINT ["entrypoint.sh"] entrypoint.sh #!/usr/bin/env bash ulimit -n 5000000 结果: /usr/

Dockerfile

FROM ubuntu:18.04

ADD entrypoint.sh /usr/local/bin/
RUN chown root:root /usr/local/bin/entrypoint.sh
RUN chmod 4755 /usr/local/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
entrypoint.sh

#!/usr/bin/env bash

ulimit -n 5000000
结果: /usr/local/bin/entrypoint.sh:第3行:ulimit:打开的文件:无法修改限制:不允许操作


如何解决此问题?

您可以在参数中执行此操作

docker run -it --ulimit nofile=1024:1024  --rm --name testE test bash

单击

您正试图修改主机或容器的ulimit?问题可能是/etc/security/limits.conf中的“nofile”硬设置小于您试图设置的设置。
docker run -it --ulimit nofile=1024:1024  --rm --name testE test bash