Docker build ends with error “the command … returned a non-zero code: 100”

I am building a Docker image and the Dockerfile looks like follow:

FROM ubuntu:12.04
MAINTAINER Maintainer Name <my_address@goes.here>

VOLUME ["/var/www"]

RUN apt-get update && \
    apt-get install -y \
    apache2 \
    php5 \
    php5-cli \
    libapache2-mod-php5 \
    php5-gd \
    php5-ldap \
    php5-mysql

COPY apache_default /etc/apache2/sites-available/default
COPY run /usr/local/bin/run
RUN chmod +x /usr/local/bin/run
RUN a2enmod rewrite

EXPOSE 80
CMD ["/usr/local/bin/run"]

The run file contains the following code:

  • Running rails migrations in docker container sometimes results in ActiveRecord::DuplicateMigrationNameError
  • Cache gems in GitLab CI bundle build
  • Make 2 volumes in docker gcc and java
  • Can't use 127.0.0.1 to connect mysql server docker container, but can use IP?
  • Where is my Docker WordPress Website Storing Data?
  • Apache Ignite cache operation failure
  • #!/bin/bash
    set -e
    
    PHP_ERROR_REPORTING=${PHP_ERROR_REPORTING:-"E_ALL & ~E_DEPRECATED & ~E_NOTICE"}
    sed -ri 's/^display_errors\s*=\s*Off/display_errors = On/g' /etc/php5/apache2/php.ini
    sed -ri 's/^display_errors\s*=\s*Off/display_errors = On/g' /etc/php5/cli/php.ini
    sed -ri "s/^error_reporting\s*=.*$//g" /etc/php5/apache2/php.ini
    sed -ri "s/^error_reporting\s*=.*$//g" /etc/php5/cli/php.ini
    echo "error_reporting = $PHP_ERROR_REPORTING" >> /etc/php5/apache2/php.ini
    echo "error_reporting = $PHP_ERROR_REPORTING" >> /etc/php5/cli/php.ini
    
    source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND
    

    I am seeing some errors output to the console when I run the command:

    docker build -t dev-image .
    

    The lines marked with --- (this is just for show you the lines doesn’t mean that the ouput has such symbol) at the end are marked in red in the console:

    ...
    Get:69 http://archive.ubuntu.com/ubuntu/ precise-updates/main ssl-cert all 1.0.28ubuntu0.1 [12.3 kB]
    debconf: delaying package configuration, since apt-utils is not installed ---
    Fetched 26.7 MB in 48s (550 kB/s)
    ...
    Unpacking ucf (from .../ucf_3.0025+nmu2ubuntu1_all.deb) ...
    Moving old data out of the way ---
    Selecting previously unselected package ttf-dejavu-core
    ...
    Setting up ucf (3.0025+nmu2ubuntu1) ...
    debconf: unable to initialize frontend: Dialog ---
    debconf: (TERM is not set, so the dialog frontend is not usable.) ---
    debconf: falling back to frontend: Readline ---
    debconf: unable to initialize frontend: Readline ---
    debconf: (This frontend requires a controlling tty.) ---
    debconf: falling back to frontend: Teletype ---
    Setting up ttf-dejavu-core (2.33-2ubuntu1) ...
    ...
    Setting up php5-cli (5.3.10-1ubuntu3.24) ...
    debconf: unable to initialize frontend: Dialog ---
    debconf: (TERM is not set, so the dialog frontend is not usable.) ---
    debconf: falling back to frontend: Readline ---
    debconf: unable to initialize frontend: Readline ---
    debconf: (This frontend requires a controlling tty.) ---
    debconf: falling back to frontend: Teletype ---
    
    Creating config file /etc/php5/cli/php.ini with new version ---
    update-alternatives: using /usr/bin/php5 to provide /usr/bin/php (php) in auto mode.
    ...
    Setting up apache2-mpm-prefork (2.2.22-1ubuntu1.11) ...
    invoke-rc.d: policy-rc.d denied execution of start. ---
    Setting up apache2 (2.2.22-1ubuntu1.11) ...
    ...
    ldconfig deferred processing now taking place
    
    Errors were encountered while processing:
     ssl-cert
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    The command '/bin/sh -c apt-get update &&     apt-get install -y     apache2     php5     php5-cli     libapache2-mod-php5     php5-gd     php5-ldap     php5-mysql' returned a non-zero code: 100
    

    Why? What I am not notice here? Did I miss something?

    I am running Docker 1.10.3 in Fedora 24:

    $ docker -v
    Docker version 1.10.3, build a612434/1.10.3
    

    UPDATE

    After I had remove all the images & containers and run a clean build using --no-cache I can see this error now:

    Setting up ssl-cert (1.0.28ubuntu0.1) ...
    debconf: unable to initialize frontend: Dialog
    debconf: (TERM is not set, so the dialog frontend is not usable.)
    debconf: falling back to frontend: Readline
    debconf: unable to initialize frontend: Readline
    debconf: (This frontend requires a controlling tty.)
    debconf: falling back to frontend: Teletype
    groupadd: failure while writing changes to /etc/group
    addgroup: `/usr/sbin/groupadd -g 102 ssl-cert' returned error code 10. Exiting.
    dpkg: error processing ssl-cert (--configure):
     subprocess installed post-installation script returned error exit status 1
    

    Which makes sense with the error, the question is why?

  • docker-compose scale service with independent volumes
  • Docker: unable to find user root: no matching entries in passwd file
  • Docker security issue
  • Can't connect to Postgres container with Docker Compose from Sequelize
  • Fail2ban filter for docker sshd container using syslog
  • Why does building from a docker file take up all the disk space?
  • One Solution collect form web for “Docker build ends with error “the command … returned a non-zero code: 100””

    I’ve stepped through your Dockerfile manually using docker run -it ubuntu:12.04 and going through the steps (which is a good tip, by the way, when you’re putting together a complex image).

    The apt-get commands all worked fine for me. Your error is about the ssl-cert install, so your build failed on the first RUN instruction and the rest of the Dockerfile won’t have been processed.

    Possibly a temporary issue when you were building? Have you tried again or on a different host?

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