title: Docker compose service keeps using the wrong Dockerfile
body: <p>I have a .NET project with the following folder structure (stripped down for brevity's sake)</p>
  <pre><code>myproject/
  ├─ docker/
  │  ├─ sql/
  │  │  ├─ docker-compose.yaml/
  │  │  ├─ Dockerfile/
  ├─ src/
  ├─ tests/
  │  ├─ integrationtests/
  │  │  ├─ docker-compose.yaml/
  │  │  ├─ Dockerfile/
  </code></pre>
  <p>The following docker-compose file is defined in the <code>integrationtests</code> folder:</p>
  <pre><code>version: &quot;3.9&quot;
  
  services:
    my-db:
      container_name: my-db
      build:
        context: ../../docker/sql
        dockerfile: ${PWD:-.}/Dockerfile
      ports:
        - &quot;1433:1433&quot;
      
    integration-tests:
      depends_on:
        - my-db
      build: ./
      volumes:
        - ../../:/app
      working_dir: /app
      environment:
        - ConnectionString__MySqlServerDb=Data Source=my-db;User ID=sa;Password=$str0ngP@ss2;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False
      command: &quot;dotnet test pathToIntegrationTestProj&quot;
  </code></pre>
  <p>Dockerfile inside integrationtests:</p>
  <pre><code>FROM mcr.microsoft.com/dotnet/sdk:5.0
  
  ENV REPORTGENERATOR_VERSION 4.8.12
  
  RUN dotnet tool install dotnet-reportgenerator-globaltool \
      --tool-path /tools \
      --version $REPORTGENERATOR_VERSION
  </code></pre>
  <p>Dockerfile inside <code>./docker/sql</code>:</p>
  <pre><code>FROM mcr.microsoft.com/mssql/server:2019-latest
  ## Run some script to seed database
  </code></pre>
  <p>Up until yesterday, if I ran <code>docker-compose up integration-tests</code>, it would spin up <code>my-db</code> and run the integration tests. But for some reason the <code>my-db</code> service is no longer able to use the <code>docker/sql/Dockerfile</code> anymore.</p>
  <p>If I run <code>docker-compose up my-db</code>, in the logs I can see that it's trying to use the Dockerfile inside <code>integrationtest</code> folder instead, which doesn't make any sense to me. I am clearly setting the build context and dockerfile path in <code>my-db</code>'s definition.</p>
  <p>Could someone shed some light on this issue?</p>