Skip to content

Instantly share code, notes, and snippets.

@redpop
Created December 4, 2021 17:23
Show Gist options
  • Save redpop/7b038265b3de993f629208326efcaa0b to your computer and use it in GitHub Desktop.
Save redpop/7b038265b3de993f629208326efcaa0b to your computer and use it in GitHub Desktop.
Docker compose snippets
# Docker Compose reuses anonymous volumes created by the previous containers for the new containers. This way the new cache container can reuse the cache from the old container. To force Docker Compose to renew anonymous volumes for the new containers, we use:
docker compose up --build --force-recreate -V
# -----------------------------------------------------------------------------
# Deploying changes
# When you make changes to your app code, remember to rebuild your image and recreate your app’s containers. To redeploy a service called web, use:
docker-compose build web
docker-compose up --no-deps -d web
# This first rebuilds the image for web and then stop, destroy, and recreate just the web service. The --no-deps flag prevents Compose from also recreating any services which web depends on.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment