Linux docker entrypoint.sh没有root用户的权限
DockerfileLinux 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/
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