【问题标题】:docker entrypoint.sh not have the permission of rootdocker entrypoint.sh 没有root权限
【发布时间】:2020-05-20 07:22:30
【问题描述】:

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"]

入口点.sh

#!/usr/bin/env bash

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

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

如何解决问题?

【问题讨论】:

  • 你是在修改宿主机的ulimit还是容器的ulimit?
  • 问题可能是 /etc/security/limits.conf 中的“nofile”硬设置小于您尝试设置的值。

标签: linux bash docker


【解决方案1】:

你可以在参数中做到这一点

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

点击set-ulimits-in-container

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-10-08
    • 2015-01-28
    • 1970-01-01
    • 2023-03-18
    • 1970-01-01
    • 2013-11-18
    • 2018-01-05
    相关资源
    最近更新 更多