Code Not Mounting in Docker Container on Windows with Skaffold

I’m running into an issue where my code is not being mounted into my Docker container when using Skaffold on Windows. My setup involves a Kubernetes cluster managed by Skaffold, and I’m developing on a Windows machine.
Here’s my setup:
Skaffold Configuration (skaffold.yaml):

apiVersion: skaffold/v2beta12
kind: Config
metadata:
  name: healthflow
build:
  local:
    push: true
  artifacts:
    - image: yazangali/authservice
      context: authservice
      docker:
        dockerfile: Dockerfile # Production Dockerfile
    - image: yazangali/userservice
      context: userservice
      docker:
        dockerfile: Dockerfile # Production Dockerfile
deploy:
  kubectl:
    manifests:
      - k8s/authservice/deployment.yaml
      - k8s/authservice/service.yaml
      - k8s/userservice/deployment.yaml
      - k8s/userservice/service.yaml
      - k8s/nginx-deployment.yaml
      - k8s/nginx-service.yaml
      - k8s/nginx-configmap.yaml
profiles:
  - name: development
    build:
      artifacts:
        - image: yazangali/authservice-dev
          context: authservice
          docker:
            dockerfile: Dockerfile.dev # Use the dev Dockerfile for development
        - image: yazangali/userservice-dev
          context: userservice
          docker:
            dockerfile: Dockerfile.dev # Use the dev Dockerfile for development
    deploy:
      kubectl:
        manifests:
          - k8s/authservice/deployment-dev.yaml
          - k8s/authservice/service.yaml
          - k8s/userservice/deployment-dev.yaml
          - k8s/userservice/service.yaml
          - k8s/nginx-deployment.yaml
          - k8s/nginx-service.yaml
          - k8s/nginx-configmap.yaml
  - name: production
    build:
      artifacts:
        - image: yazangali/authservice
          context: authservice
          docker:
            dockerfile: Dockerfile # Use the production Dockerfile
        - image: yazangali/userservice
          context: userservice
          docker:
            dockerfile: Dockerfile # Use the production Dockerfile
    deploy:
      kubectl:
        manifests:
          - k8s/authservice/deployment.yaml
          - k8s/authservice/service.yaml
          - k8s/userservice/deployment.yaml
          - k8s/userservice/service.yaml
          - k8s/nginx-deployment.yaml
          - k8s/nginx-service.yaml
          - k8s/nginx-configmap.yaml

Kubernetes Deployment for Development (deployment-dev.yaml):

apiVersion: apps/v1
kind: Deployment
metadata:
  name: authservice
spec:
  replicas: 1
  selector:
    matchLabels:
      app: authservice
  template:
    metadata:
      labels:
        app: authservice
    spec:
      containers:
        - name: authservice
          image: yazangali/authservice-dev
          ports:
            - containerPort: 3000
          env:
            - name: NODE_ENV
              value: "development"
          volumeMounts:
            - name: auth-code
              mountPath: /usr/src/app
      volumes:
        - name: auth-code
          hostPath:
            path: "/mnt/c/Users/FPCC/Desktop/web-dev/healthflow/authservice"
            type: DirectoryOrCreate

Dockerfile for Development (Dockerfile.dev):

FROM node:14

WORKDIR /usr/src/app

COPY package*.json ./
RUN npm install

COPY . .

CMD ["npm", "run", "dev"]

When I run

skaffold dev -p development

the services are created, but the src folder inside the container is empty. As a result, Nodemon cannot find the src/index.ts file and throws an ERR_MODULE_NOT_FOUND error.

I’ve ensured that Docker Desktop is set up to share the C: drive and that the paths are correctly formatted using /mnt/c/….

I believe the problem is in the way of how mounting works in kubernetes pods.

What could be causing the code not to mount properly inside the container? How can I resolve this issue so that my code is correctly mounted and Nodemon can detect changes?

I configured Skaffold to use a development profile with volume mounts to share my local code with the Docker container. I ensured the paths were correct and that Docker Desktop was set up to share my C: drive. I expected the src folder inside the container to contain my local code and for Nodemon to restart the service on code changes.

However, when I ran skaffold dev -p development, the services started, but the src folder inside the container was empty. Nodemon couldn’t find the src/index.ts file and threw an ERR_MODULE_NOT_FOUND error.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật