title: How do I ensure docker is running the new code in my containers when starting up?
body: <p>I am currently writing a webapp - java backend, react front end and have been deploying via a docker compose file. I've made changes and when I try to run them via yarn build for my front end server and starting my back end server with maven, the changes appear. However, when running with docker, the changes aren't there.</p>
  <p>I've been using the <strong>docker compose up</strong> and <strong>docker compose down</strong> commands and I even run <strong>docker system prune -a</strong> after stopping my docker containers via the docker compose down command but my new changes aren't showing. I'd appreciate any guidance on what I'm doing wrong to help show my changes.</p>
  <p>I also have docker desktop and have manually gone and deleted all of the volumes, containers and images so that they have to be regenerated. Running the build commands to specify ignoring cache didn't help either.</p>
  <p>I also deleted the .m2 folder so that this gets generated (my understanding is that this is the cache store for the backend). My changes are mainly on the front end but since my front end container depends on this, I thought regenerating the back-end container may have a knock on effect that may help.</p>
  <p>I would greatly appreciate any help, please do let me know if there's anything else to help with context. The changes involve removing a search bar and some text, both of which are commented out in the code but still appear whilst I also add another button which doesn't show up.</p>
  <p>My docker compose file is below as follows:</p>
  <pre><code>
  services:
    mysqldb:
  #    image: mysql:5.7
      build: ./Database
      restart: unless-stopped
      env_file: ./.env
      environment:
        - MYSQL_ROOT_PASSWORD=$MYSQLDB_ROOT_PASSWORD
        - MYSQL_DATABASE=$MYSQLDB_DATABASE
      ports:
        - $MYSQLDB_LOCAL_PORT:$MYSQLDB_DOCKER_PORT
      volumes:
        - db:/var/lib/mysql
      networks:
        - backend
  
    app_backend:
      depends_on:
        - mysqldb
      build: ./
      restart: on-failure
      env_file: ./.env
      ports:
        - $SPRING_LOCAL_PORT:$SPRING_DOCKER_PORT
      environment:
        SPRING_APPLICATION_JSON: '{
          &quot;spring.datasource.url&quot;  : &quot;jdbc:mysql://mysqldb:$MYSQLDB_DOCKER_PORT/$MYSQLDB_DATABASE?useSSL=false&amp;allowPublicKeyRetrieval=true&amp;serverTimezone=UTC&quot;,
          &quot;spring.datasource.username&quot; : &quot;$MYSQLDB_USER&quot;,
          &quot;spring.datasource.password&quot; : &quot;$MYSQLDB_ROOT_PASSWORD&quot;,
          &quot;spring.jpa.properties.hibernate.dialect&quot; : &quot;org.hibernate.dialect.MySQL5InnoDBDialect&quot;,
          &quot;spring.jpa.hibernate.ddl-auto&quot; : &quot;update&quot;
        }'
      volumes:
        - .m2:/root/.m2
      stdin_open: true
      tty: true
      networks:
        - backend
        - frontend
  
    app_frontend:
      depends_on:
        - app_backend
      build:
        ../MyProjectFrontEnd
      restart: on-failure
      ports:
        - 80:80
      networks:
        - frontend
  
  volumes:
    db:
  
  networks:
    backend:
    frontend:
  </code></pre>
  <p>Since the issue is on the front end, I've also attached the dockerfile for the front end below:</p>
  <pre><code>FROM node:16.13.0-alpine AS react-build
  WORKDIR /MyProjectFrontEnd
  RUN yarn cache clean
  RUN yarn install
  COPY . ./
  RUN yarn
  RUN yarn build
  
  # Stage 2 - the production environment
  FROM nginx:alpine
  COPY nginx.conf /etc/nginx/conf.d/default.conf
  COPY /build /usr/share/nginx/html
  EXPOSE 80
  CMD [&quot;nginx&quot;, &quot;-g&quot;, &quot;daemon off;&quot;]
  </code></pre>
  <p><strong>Update - the cache in the browser was storing some (rookie error) however, not all the changes are still being loaded</strong></p>