How to solve “invoke-rc.d: policy-rc.d denied execution of start.” when building a container Ubuntu

问题场景:通过Dockerfile构建基于ubuntu的apache服务器时报错

invoke-rc.d: policy-rc.d denied execution of start.

在stackoverflow站点上看到一个问题回答,借鉴后解决了我的问题,答案如下

Here is a good post which tries to root cause the issue you are facing.

Shorter way:

    RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d should resolve your issue OR

    If that doesn't resolve the issue, try running your docker container with privileged option. Like this, docker run --privileged -d -ti DOCKER_IMAGE:TAG

Ideally, I would not recommend running container with privileged option unless its a test bed container. The reason being running a docker container with privileged gives all capabilities to the container, and it also lifts all the limitations enforced. In other words, the container can then do almost everything that the host can do. But this is not a good practice. This defeats the docker purpose of isolating from host machine.

The ideal way to do this is to set capabilities of your docker container based on what you want to achieve. Googling this should help you out to provide appropriate capability for your docker container

在Dockerfile中加上

RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d

重新构建后就没有报这个错误了

To solve the "error while loading shared libraries: libmwcpp11compat.iso: cannot open shared object" issue when loading MATLAB 2017b in Linux, you can try the following steps: 1. First, make sure that the library file exists in the correct location. You can verify this by using the `find` command in the terminal: ``` find /usr/local/MATLAB/R2017b -name libmwcpp11compat.so ``` If the library is not found, it might be missing or corrupted. In that case, you can proceed to the next step. 2. Reinstall the MATLAB Runtime. MATLAB ships with its own Runtime environment, and reinstalling it can help resolve library-related issues. You can download the MATLAB Runtime installer from the MathWorks website and follow their instructions for installation. 3. Set the correct library path. Open the terminal and enter the following command to set the library path: ``` export LD_LIBRARY_PATH=/usr/local/MATLAB/R2017b/bin/glnxa64:$LD_LIBRARY_PATH ``` Replace `/usr/local/MATLAB/R2017b` with your actual MATLAB installation path if it is different. 4. Try running MATLAB again and check if the issue persists. If it does, you can try enabling symbolic linking for shared libraries by running the following command: ``` sudo ldconfig ``` 5. If none of the above solutions work, you can contact MathWorks support for further assistance. They can provide more specific guidance based on your system configuration and the error you are encountering. Remember to provide them with detailed information about the error message and your system setup to help them diagnose and resolve the issue more effectively.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值