title: Laravel docker image "Could not open input file: /var/www/html/artisan"
body: <p>I'm attempting to build and run a Laravel docker image which was originally generated via Laravel sail. When using <code>docker-compose up</code>, it correctly runs and I am able to access the site. Running <code>docker build docker/7.4/ -t &lt;tagname&gt;</code> followed by <code>docker run &lt;tagname&gt;</code> results in the following error logs however:</p>
  <p><a href="https://i.stack.imgur.com/F6Pc8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F6Pc8.png" alt="Example error log, showing &quot;Could not open input file: /var/www/html/artisan&quot;" /></a></p>
  <p>I have tracked this error down to my supervisord.conf file, where it is trying to call <code>/var/www/html/artisan serve</code>, but is seemingly unable to resolve it.</p>
  <p><strong>supervisord.conf:</strong></p>
  <pre><code>[supervisord]
  nodaemon=true
  user=root
  logfile=/var/log/supervisor/supervisord.log
  pidfile=/var/run/supervisord.pid
  
  [program:php]
  command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80
  user=sail
  environment=LARAVEL_SAIL=&quot;1&quot;
  stdout_logfile=/dev/stdout
  stdout_logfile_maxbytes=0
  stderr_logfile=/dev/stderr
  stderr_logfile_maxbytes=0
  </code></pre>
  <p>Here is also the Dockerfile I'm using, as well as the start-container script it runs</p>
  <p><strong>Dockerfile:</strong></p>
  <pre><code>FROM ubuntu:20.04
  
  LABEL maintainer=&quot;Taylor Otwell&quot;
  
  ARG WWWGROUP
  
  WORKDIR /var/www/html
  
  ENV DEBIAN_FRONTEND noninteractive
  ENV TZ=UTC
  
  RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &amp;&amp; echo $TZ &gt; /etc/timezone
  
  RUN apt-get update \
      &amp;&amp; apt-get install -y gosu curl zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2
  
  RUN apt-get install -y gnupg ca-certificates
  
  RUN mkdir -p ~/.gnupg \
      &amp;&amp; chmod 600 ~/.gnupg \
      &amp;&amp; echo &quot;disable-ipv6&quot; &gt;&gt; ~/.gnupg/dirmngr.conf \
      &amp;&amp; apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E5267A6C \
      &amp;&amp; apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C300EE8C \
      &amp;&amp; echo &quot;deb http://ppa.launchpad.net/ondrej/php/ubuntu focal main&quot; &gt; /etc/apt/sources.list.d/ppa_ondrej_php.list \
      &amp;&amp; apt-get update \
      &amp;&amp; apt-get install -y php7.4-cli php7.4-dev \
         php7.4-pgsql php7.4-sqlite3 php7.4-gd \
         php7.4-curl php7.4-memcached \
         php7.4-imap php7.4-mysql php7.4-mbstring \
         php7.4-xml php7.4-zip php7.4-bcmath php7.4-soap \
         php7.4-intl php7.4-readline php7.4-pcov \
         php7.4-msgpack php7.4-igbinary php7.4-ldap \
         php7.4-redis \
      &amp;&amp; php -r &quot;readfile('http://getcomposer.org/installer');&quot; | php -- --install-dir=/usr/bin/ --filename=composer \
      &amp;&amp; curl -sL https://deb.nodesource.com/setup_15.x | bash - \
      &amp;&amp; apt-get install -y nodejs \
      &amp;&amp; curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
      &amp;&amp; echo &quot;deb https://dl.yarnpkg.com/debian/ stable main&quot; &gt; /etc/apt/sources.list.d/yarn.list \
      &amp;&amp; apt-get update \
      &amp;&amp; apt-get install -y yarn \
      &amp;&amp; apt-get install -y mysql-client \
      &amp;&amp; apt-get install -y postgresql-client \
      &amp;&amp; apt-get -y autoremove \
      &amp;&amp; apt-get clean \
      &amp;&amp; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
  
  RUN setcap &quot;cap_net_bind_service=+ep&quot; /usr/bin/php7.4
  
  # RUN groupadd --force -g www-data sail
  RUN useradd -ms /bin/bash --no-user-group -g www-data -u 1337 sail
  
  COPY start-container /usr/local/bin/start-container
  COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
  COPY php.ini /etc/php/7.4/cli/conf.d/99-sail.ini
  RUN chmod +x /usr/local/bin/start-container
  
  EXPOSE 8000
  
  ENTRYPOINT [&quot;start-container&quot;]
  </code></pre>
  <p><strong>start-container:</strong></p>
  <pre><code>#!/usr/bin/env bash
  
  if [ ! -z &quot;$WWWUSER&quot; ]; then
      usermod -u $WWWUSER sail
  fi
  
  if [ ! -d /.composer ]; then
      mkdir /.composer
  fi
  
  chmod -R ugo+rw /.composer
  
  if [ $# -gt 0 ];then
      exec gosu $WWWUSER &quot;$@&quot;
  else
      /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
  fi
  </code></pre>
  <p><strong>docker-compose.yml:</strong></p>
  <pre><code>version: '3'
  services:
      laravel.test:
          build:
              context: ./docker/7.4
              dockerfile: Dockerfile
              args:
                  WWWGROUP: 'www-data'
          container_name: laravel
          image: sail-7.4/app
          ports:
              - '${APP_PORT:-80}:80'
          environment:
              WWWUSER: 'sail'
              LARAVEL_SAIL: 1
          volumes:
              - '.:/var/www/html'
          networks:
              - sail
          depends_on:
              - mysql
      mysql:
          image: 'mysql:8.0'
          container_name: 'mysql'
          restart: 'unless-stopped'
          tty: 'true'
          ports:
              - '${FORWARD_DB_PORT:-3306}:3306'
          environment:
              MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
              MYSQL_DATABASE: '${DB_DATABASE}'
              MYSQL_USER: '${DB_USERNAME}'
              MYSQL_PASSWORD: '${DB_PASSWORD}'
              MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
              SERVICE_TAGS: 'dev'
              SERVICE_NAME: 'mysql'
          volumes:
              - 'sailmysql:/var/lib/mysql'
          networks:
              - sail
          healthcheck:
            test: [&quot;CMD&quot;, &quot;mysqladmin&quot;, &quot;ping&quot;]
  networks:
      sail:
          driver: bridge
  volumes:
      sailmysql:
          driver: local
  
  </code></pre>
  <p>I am fairly new to using docker, so the process is somewhat confusing to me. Any help on where to look for this or how to debug it would be greatly appreciated - as well as an explanation as to why it's unable to resolve the php artisan command in supervisord.conf</p>