Docker compose mounts volume for one service only

  docker, docker-compose

I am trying to build two services that mount the same volumes. Running the following docker-compose configuration allows the cms service to mount the directory, however, the client service does not mount the directory.

I’ve tried docker inspect for the service, and mounts is just an empty array.

version: "2"
services:
  cms:
    container_name: cms_keystone
    build: ./cms_keystone/
    network_mode: bridge
    environment:
      - NODE_ENV=docker_production
    ports:
      - "3010:3000"
    volumes:
      - /data/naqib.info_static_content:/data/naqib.info_static_content:rw

  client:
    container_name: client_nextjs
    build: ./client_nextjs/
    network_mode: bridge
    environment:
      - NODE_ENV=docker_production
      # - YARN_CACHE_FOLDER=/data/naqib.info_static_content/shm/yarn_cache
    ports:
      - "8001:7001"
      - "8002:7002"
    depends_on:
      - cms
    volumes:
      - /data/naqib.info_static_content:/data/naqib.info_static_content:r
  

Any suggestion what should I do to debug?

Source: Docker Questions

LEAVE A COMMENT