title: How to run docker-compose inside VS Code devcontainer
body: <p>I have this multi-container project comprised of 3 NestJS and 1 dotnet5.0 application. Besides the applications, the project depends on a RabbitMQ and an InfluxDB services (running as pure docker images)</p>
  <p>The <code>docker-compose</code> file looks like this:</p>
  <pre class="lang-yaml prettyprint-override"><code>version: '3.8'
  
  services:
    influxdb:
      image: influxdb:2.0
      container_name: influxdb
      ports:
        - '8086:8086'
      expose:
        - '8086'
      volumes:
        - ./data/influxdb2/data:/var/lib/influxdb2
        - ./data/influxdb2/config:/etc/influxdb2
  
    rabbitmq:
      hostname: 'rabbitmq'
      image: rabbitmq:3-management
      container_name: rabbitmq
      ports:
        - '15672:15672'
        - '5672:5672'
  
    microservice1:
      image: microservice1
      container_name: microservice1
      depends_on: [rabbitmq, influxdb]
      build:
        context: .
        dockerfile: ./apps/microservice1/Dockerfile
  
    microservice2:
      image: microservice2
      container_name: microservice2
      depends_on: [rabbitmq, influxdb]
      build:
        context: .
        dockerfile: ./apps/microservice2/Dockerfile
  
    microservice3:
      image: microservice3
      container_name: microservice3
      depends_on: [rabbitmq, influxdb]
      build:
        context: .
        dockerfile: ./apps/microservice3/Dockerfile
  
    microservice4:
      image: microservice4
      container_name: microservice4
      depends_on: [rabbitmq, influxdb]
      build:
        context: .
        dockerfile: ./apps/microservice4/Dockerfile
  
  </code></pre>
  <p>I want to move the whole dev. environment to the new VS Code devcontainers but I'm not quite getting how to work with dependencies (like rabbitmq and influxdb here).</p>
  <p>Ideally, I'd open the repo in a devcontainer with both nodejs and dotnet SDKs to be able to run the microservices during development. But, I don't want to also install influxdb and rabbitmq into the devcontainer as I want to leverage the existing (and convenient) docker images.</p>
  <p>Problem is, once I open the repo inside the devcontainer there's no way to interact with docker-compose from the inside (as docker/docker-compose is not available inside the devcontainer).</p>
  <p>Is it possible to interact with Docker engine on the host from inside the container? So I can simply have a <code>dev.sh</code> script that can simply <code>up</code> the rabbitmq and influxdb dependencies and then launch whatever microservice I want to run?</p>
  <p>Maybe I'm getting it all wrong but I couldn't find a clear explanation on how to mix VS Code devcontainers and docker-compose files (with image-based dependencies).</p>