1. I have built an image for my app with apache, container created from it is working just fine. I am able to see the page on localhost. (file #1: docker-compose.yml)
2. I push image to docker hub
3. I recreate a container using another (file #2: docker-compose-prod.yml) for the same app and it's exited immediately without any error, container output was:

***Module rewrite already enabled 
httpd (pid 1) already running***

Here is app service described in docker-compose.yml file #1 which I used for build:

```
 app:
    build: .
    links:
        - db
        - memcache:memcached
        - search
    ports:
        #- 8080:80   # when varnish enabled
        - 80:80
    restart: always
    environment:
        DB_HOST: db:3306
        DB_PASSWORD: *****
        SEARCH_HOST: search:9312
        MEMCACHE_HOST: memcache:11211

```

Here is docker-compose-prod.yml, file #2 I used for deployment which contains problem:

```
  app:
    image: vendor/app
    #restart: always
    links:
        - db
        - memcache:memcached
        - search
    ports:
        #- 8080:80   # when varnish enabled
        - 80:80
    environment:
        DB_HOST: db:3306
        DB_PASSWORD: *****
        SEARCH_HOST: search:9312
        MEMCACHE_HOST: memcache:11211
    #networks:
        #- proxy
        #- backend

```

Containers of next services are always up and running: 

```
    - db
    - memcache:memcached
    - search

```

**Some details:** 

I run docker-compose.yml (file#1) from within app directory: 

`/home/user/app1$ docker-compose up -d` 

and second file from another directory 

`/home/user/app2$ docker-compose -f docker-compose-prod.yml up -d`

Here is Dockerfile: 

```
FROM ubuntu:trusty
MAINTAINER vendor

# Install base packages
RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get -yq install \
        curl \
        apache2 \
        libapache2-mod-php5 \
        php5-mysql \
        php5-mcrypt \
        php5-gd \
        php5-curl \
        php-pear \
        php5-memcache \
        php-apc && \
    rm -rf /var/lib/apt/lists/*

#ENV ALLOW_OVERRIDE **False**

RUN /usr/sbin/php5enmod mcrypt

RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf && \
    sed -i "s/variables_order.*/variables_order = \"EGPCS\"/g" /etc/php5/apache2/php.ini

# Add image configuration and scripts
ADD run.sh /run.sh
RUN chmod 755 /*.sh

# Configure /app folder with sample app
RUN mkdir -p /app && rm -fr /var/www/html && ln -s /app /var/www/html
WORKDIR /app
ADD . /app

RUN chmod 0777 -R /var/www/html/app/tmp

RUN ln -sf /dev/stderr /var/www/html/app/tmp/logs/error.log
RUN ln -sf /dev/stdout /var/www/html/app/tmp/logs/debug.log

RUN chown www-data:www-data /app -R
# should not be run inside container
#RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
#RUN /usr/local/bin/composer install
#RUN php vendor/bin/phinx migrate

EXPOSE 80
CMD ["/run.sh"]

```

And run.sh 

```
#!/bin/bash

if [ "$ALLOW_OVERRIDE" = "**False**" ]; then
    unset ALLOW_OVERRIDE
else
    sed -i "s/AllowOverride None/AllowOverride All/g" /etc/apache2/apache2.conf
    a2enmod rewrite
fi

source /etc/apache2/envvars

exec apache2 -D FOREGROUND

```