Installing cron via apt-get fails in a docker ubuntu:12.04 container from permissions problems

I’m attempting to install cron (among other packages) via apt-get install in my Dockerfile.
I’ve simplified my Dockerfile down to a bare minimum of:

FROM ubuntu:12.04
RUN apt-get update
RUN apt-get install -y cron

The error that I’m seeing during the install process is:

  • Run a new container based on currently running container
  • Issue when I try to create a docker image [duplicate]
  • Change Docker native images location on Windows 10 Pro
  • Trying to pull image from
  • Docker communication between apps in separate containers
  • Sample docker compose setup for web application devops
  • 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:
    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 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:
    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

    Running $ groupadd /etc/group manually inside the docker container results in the same error “groupadd: failure while writing changes to /etc/group”.

    Other packages such as wget and curl are installed fine. Is there a process that docker needs to have running to be able to perform groupadds? Or is there a step in the Dockerfile that needs to happen first that I’m missing?

    Thanks in advance.

  • Windows Container - How to commit a container
  • How to set up Docker file to install Calabash-android?
  • Reuse containers with `docker-compose`
  • Running a simple webserver in Docker?
  • How to create multiple guest session on ubuntu or others linux distros?
  • GDB problems inside docker
  • One Solution collect form web for “Installing cron via apt-get fails in a docker ubuntu:12.04 container from permissions problems”

    I had to disable SELinux on my fedora machine running docker. Doing a setenforce 0, editing /etc/selinux/conf to disabled and rebooting my machine fixed it. I didn’t realize that my docker container would inherit permissions problems from the machine running it.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.