Docker Community Forums

Share and learn in the Docker community.

Why my docker images, built by “docker-compose build”, don't use the code I get via “git checkout <non_master_branch>”?

Docker doesn’t use the latest code after running "git checkout ",
while I can see it in the vscode.

I am using the following docker-compose file:

version: '2'

volumes: 
  pgdata:
  backend_app:

services:
  nginx:
    container_name: nginx-angular-dev
    image: nginx-angular-dev
    build:
      context: ./frontend
      dockerfile: /.docker/nginx.dockerfile
    ports:
      - "80:80"
      - "443:443"
    depends_on:
      - web

  web:
    container_name: django-app-dev
    image: django-app-dev
    build:
      context: ./backend
      dockerfile: /django.dockerfile
    command: ["./wait-for-postgres.sh", "db", "./django-entrypoint.sh"]
    volumes:
      - backend_app:/code
    ports:
      - "8000:8000"
    depends_on:
      - db
    env_file: .env
    environment:
      FRONTEND_BASE_URL: http://192.168.99.100/
      BACKEND_BASE_URL: http://192.168.99.100/api/
      MODE_ENV: DOCKER_DEV

  db:
    container_name: django-db
    image: postgres:10
    env_file: .env
    volumes:
      - pgdata:/var/lib/postgresql/data

I have tried “docker-compose build --no-cache”,
followed by “docker-compose up --force-recreate” but it didn’t solve the problem.

What is the root of my problem?
Thanks in advance!