Posts

Showing posts with the label compose

Is it important to make docker compose down before docker compose up -d and docker restart

Image
  Is it important to make docker compose down before docker compose up -d and docker restart  Generally, NO , it is not necessary or even recommended to run docker compose down before docker compose up -d. docker compose up is designed to be declarative and intelligent; it compares your current running state with your docker-compose.yml file and only makes the changes necessary to match them. Why You Usually Don't Need down               • Automatic Updates: If you change a configuration (like environment variables or port mappings) and run up -d again, Docker will automatically stop and recreate only the containers that were affected.               • Less Downtime: Using up alone is significantly faster and results in less downtime because it doesn't stop or remove containers that don't need changes.       ...

Docker tips & tricks

Image
Docker tips & tricks 1. one-line command for build & run container at once      docker-compose up -d --build -d means in background (daemon)  2.  speedup docker builds 3.  Rebuild containers using docker compose when dockerfile changes           docker-compose up --force-recreate 4.   If I have a bad deploy this may help      docker-compose build --no-cache 5. R emove all images      docker-compose down --rmi ("local"|"all") 6. Automatically update services with file watch  in Docker Compose ( experimental,  Docker Desktop 4.24.0 said that this feature is now open for all )             docker-compos up --watch 7. Removing containers with the data ( be careful, you will lose all your data for the containers that are ...