简体   繁体   English

docker entrypoint.sh没有root权限

[英]docker entrypoint.sh not have the permission of root

Dockerfile 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入口点.sh

#!/usr/bin/env bash

ulimit -n 5000000
docker build -t test .
docker run -it --rm --name testE test bash  

result: /usr/local/bin/entrypoint.sh: line 3: ulimit: open files: cannot modify limit: Operation not permitted结果:/usr/local/bin/entrypoint.sh:第3行:ulimit:打开文件:无法修改限制:不允许操作

How to resolve the problem?如何解决问题?

you can do it in parameter你可以在参数中做到这一点

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

Click set-ulimits-in-container点击set-ulimits-in-container

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM