linux-通过apt-get安装cron在docker ubuntu:12.04容器中由于权限问题而失败
作者:互联网
我正在尝试通过apt-get install在我的Dockerfile中安装cron(以及其他软件包).
我已经将Dockerfile简化到最低限度:
FROM ubuntu:12.04
RUN apt-get update
RUN apt-get install -y cron
我在安装过程中看到的错误是:
Step 4 : RUN apt-get install -y cron
---> Running in 991339f4be58
Reading package lists...
Building dependency tree...
Reading state information...
Suggested packages:
anacron logrotate checksecurity exim4 postfix mail-transport-agent
The following NEW packages will be installed:
cron
0 upgraded, 1 newly installed, 0 to remove and 12 not upgraded.
Need to get 85.0 kB of archives.
After this operation, 308 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ precise-updates/main cron amd64 3.0pl1-120ubuntu4 [85.0 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 85.0 kB in 0s (204 kB/s)
Selecting previously unselected package cron.
(Reading database ... 7551 files and directories currently installed.)
Unpacking cron (from .../cron_3.0pl1-120ubuntu4_amd64.deb) ...
Setting up cron (3.0pl1-120ubuntu4) ...
Adding group `crontab' (GID 102) ...
groupadd: failure while writing changes to /etc/group
addgroup: `/usr/sbin/groupadd -g 102 crontab' returned error code 10. Exiting.
dpkg: error processing cron (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
cron
E: Sub-process /usr/bin/dpkg returned an error code (1)
2014/07/03 10:09:13 The command [/bin/sh -c apt-get install -y cron] returned a non-zero code: 100
在docker容器内手动运行$groupadd / etc / group会导致相同的错误“ groupadd:将更改写入/ etc / group时失败”.
其他软件包,例如wget和curl都可以很好地安装. docker是否需要运行某个进程才能执行groupadds?还是Dockerfile中缺少我首先需要发生的步骤?
提前致谢.
解决方法:
我必须在运行docker的fedora计算机上禁用SELinux.进行setenforce 0,将/ etc / selinux / conf编辑为禁用,然后重新启动计算机即可修复该问题.我没有意识到我的Docker容器会从运行它的机器继承权限问题.
标签:docker,ubuntu-12-04,linux 来源: https://codeday.me/bug/20191029/1959541.html