docker-compose not showing any changes to code

As far as I can tell, docker-compose up only builds images that don't exist already; it will not rebuild an image whose source has changed. If you want to rebuild your image, run docker-compose build before docker-compose up.


To force the image to be rebuilt after a change in the source, use the --build flag:

docker-compose up --build

will rebuild all layers after the layer with the changes. For layers before the change, docker uses the cache versions.

This avoids having to use two separate commands as per @jwodder's answer.


You can use

$ docker-compose build --no-cache
$ docker-compose up --force-recreate

taken from https://vsupalov.com/docker-compose-runs-old-containers/