Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

269
Views
Docker volumes - share file between two containers

I've got a Javascript helper file that contains general functions

Instead of duplicating it to both my containers (Node server and Vue frontend application) I thought I'll try creating a volume and sharing it between my containers So I've put it inside a folder called "Shared" in my root directory above my client and server folder which I turn into containers.

file system structure on my local machine:

root
--server
--client
--shared
--docker-compose.yml

Dockerfile

FROM node:latest as builder
WORKDIR /app
COPY package.json .
RUN npm install
COPY . ./
ENV PORT 8000
EXPOSE $PORT
RUN npm run build

Docker-compose.yml file

 client:
    build:
      context: ./client
      args:
        NODE_ENV: production
    volumes:
      - ./client:/app
      - /app/node_modules
      - type: bind
        source: ./shared
        target: /app/src/shared
    environment:
      - NODE_ENV=production

When I go into my container exec -it container_name bash and go into the directory i created, I can find the file there ! it was shared and is inside the container

But I cannot access it from my local machine - so I can't actually use it because its not actually created in a way that is useable for me when writing my code it just sits my in my container - inaccessible

Any ideas what I'm missing?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!