docker / dev-environments

60 stars 32 forks source link

Cannot mount a volume when running docker-compose from dev environment #133

Open sbland opened 1 year ago

sbland commented 1 year ago

Describe the bug Running a developer envionment with a docker-compose file in root. When running the compose file the volumes are not mounted.

To Reproduce Steps to reproduce the behavior:

  1. Run docker-compose up or sudo docker-compose run --entrypoint /bin/bash -v $PWD/app/client:/app client
  2. It spins up the container but no volumes are attached

Expected behavior /app should contain the contents of /app/client from the dev environment

Desktop (please complete the following information):

Version of Docker Desktop:
You can find the version by clicking on the About Docker Desktop menu

4.11.1

Additional context Compose file:

services:
  client:
    image: client
    ports:
      - 3000:3000
    build:
      context: ./app/client
    volumes:
      - ./app/client:/app
      - ./app/client/node_modules:/app/node_modules

client dockerfile:

FROM node:16

# set working directory
WORKDIR /app

ENV PATH /app/node_modules/.bin:$PATH

EXPOSE 3000
# start app
CMD ["yarn", "start"]