title: Docker-compose "no such service"
body: <p>I have an error launching <code>docker-compose up -d</code> with this docker-compose.yml file: no such service: php-c</p>
  <p>It used to work and I didn't change anything. I didn't have any docker update in the meantime either.</p>
  <p>If I remove <code>container_name</code> key then I have the same error displayed with the name which is auto-generated.</p>
  <p>I am using wsl2 and docker 20.10.8.</p>
  <pre><code>version: '3'
  
  services:
      db:
          image: mysql:5.7
          container_name: db-c
          ports:
              - 3307:3306
          volumes:
              - &quot;./.data/db:/var/lib/mysql&quot;
          environment:
              MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
              MYSQL_DATABASE: ${MYSQL_DATABASE}
              MYSQL_USER: ${MYSQL_USER}
              MYSQL_PASSWORD: ${MYSQL_PASSWORD}
  
      php:
          build:
              context: php7-fpm
              args:
                  TIMEZONE: ${TIMEZONE}
                  username: ${username}
          container_name: php-c
          volumes:
              - ${SYMFONY_APP_PATH}:/var/www/symfony
              - ./logs/symfony/:/var/www/symfony/var/logs
          environment:
              - XDEBUG_REMOTE_HOST=host.docker.internal
              - PHP_IDE_CONFIG=serverName=symfony.local
          user: 1000:1000
  
      nginx:
          build: nginx
          container_name: nginx-c
          ports:
              - 80:80
          volumes_from:
              - php
          volumes:
              - ./logs/nginx/:/var/log/nginx
  
  </code></pre>
  <p>Here is the Dockerfile.</p>
  <pre><code># See https://github.com/docker-library/php/blob/master/7.1/fpm/Dockerfile
  FROM php:7.3-fpm
  ARG TIMEZONE
  ARG username=bastien
  
  MAINTAINER Maxence POUTORD &lt;maxence.poutord@gmail.com&gt;
  
  RUN apt-get update &amp;&amp; apt-get install -y \
      openssl \
      git \
      unzip \
      libicu-dev \
      sudo \
      lsof \
      zlib1g-dev \
      libzip-dev \
      iputils-ping
  
  # Install GD
  RUN apt-get update &amp;&amp; apt-get install -y \
          libfreetype6-dev \
          libjpeg62-turbo-dev \
          libpng-dev \
      &amp;&amp; docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
      &amp;&amp; docker-php-ext-install -j$(nproc) gd
  
  # Install Composer
  RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
  RUN composer --version
  
  # Set timezone
  RUN ln -snf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime &amp;&amp; echo ${TIMEZONE} &gt; /etc/timezone
  RUN printf '[PHP]\ndate.timezone = &quot;%s&quot;\n', ${TIMEZONE} &gt; /usr/local/etc/php/conf.d/tzone.ini
  RUN &quot;date&quot;
  
  # Type docker-php-ext-install to see available extensions
  RUN docker-php-ext-install pdo pdo_mysql zip
  
  
  # install xdebug
  RUN pecl install xdebug
  RUN docker-php-ext-enable xdebug
  RUN cd /usr/local/etc/php/conf.d/ &amp;&amp; \
    echo 'memory_limit = 1G' &gt;&gt; /usr/local/etc/php/conf.d/docker-php-memlimit.ini
  COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
  #RUN echo &quot;error_reporting = E_ALL&quot; &gt;&gt; /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
  # &amp; echo &quot;display_startup_errors = On&quot; &gt;&gt; /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
  # &amp; echo &quot;display_errors = On&quot; &gt;&gt; /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
  # &amp; echo &quot;xdebug.remote_enable=1&quot; &gt;&gt; /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
  # &amp; echo &quot;xdebug.remote_connect_back=1&quot; &gt;&gt; /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
  # &amp; echo &quot;xdebug.idekey=\&quot;PHPSTORM\&quot;&quot; &gt;&gt; /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
  # &amp; echo &quot;xdebug.remote_port=9001&quot; &gt;&gt; /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
  
  # CREATE USER FOR $username
  
  RUN useradd --create-home --shell /bin/bash -u 1000 $username
  
  USER $username
  
  RUN mkdir /home/$username/.ssh \
  &amp;&amp; chmod 700 /home/$username/.ssh 
  
  COPY .bashrc /home/$username/.bashrc
  COPY config /home/$username/.ssh/config
  
  
  WORKDIR /var/www/symfony
  </code></pre>
  <p>[EDIT]<br />
  When I use restart, this works... I really don't understand what's going on.</p>
  <pre><code>docker-compose restart
  </code></pre>