Docker Community Forums

Share and learn in the Docker community.

Docker /user/sbin/apache2ctl: not found


(Danushka96) #1

I need some help with this issue on my docker installation in ubuntu OS

docker-compose.yml

version : '3'

services:
  web: 
    container_name: ${APP_NAME}_web
    build:
      context: ./docker/web
    ports:
      - 9000:80
    volumes:
      - ./:/var/www/app

DockerFile

FROM php:7.2.10-apache-stretch

RUN apt-get update -yqq && \
    apt-get install -y apt-utils zip unzip && \
    apt-get install -y nano && \
    apt-get install -y libzip-dev libpq-dev && \
    a2enmod rewrite && \
    docker-php-ext-install pdo_pgsql && \
    docker-php-ext-install pgsql && \
    docker-php-ext-configure zip --with-libzip && \
    docker-php-ext-install zip && \
    rm -rf /var/lib/apt/lists/*

RUN php -r "readfile('http://getcomposer.org/installer');"|php -- --install-dir=/usr/bin --filename=composer

COPY Default.conf /etc/apache2/sites-enabled/000-default.conf

WORKDIR /var/www/app

EXPOSE 80

CMD ['/usr/sbin/apache2ctl', '-D', 'FOREGROUND']

When I run this command

sudo docker-compose up

Terminal Output is this error

Starting Docker_Laravel_web ... done
Attaching to Docker_Laravel_web
Docker_Laravel_web | /bin/sh: 1: [/usr/sbin/apache2ctl,: not found
Docker_Laravel_web exited with code 127

Need some help to fix this,


(Hasnat) #2

Don’t update the default php apache CMD
think default is
CMD [“apache2-foreground”]
I’d recommend removing the CMD line altogether