TIL: Docker build target

EmeliaJul 20, 2026

neat docker trick I just learned:

services:

  app:

    image: ghcr.io/yourorg/yourapp:latest

    build:

      context: .

      target: dev

will pull the image by default, but build to a specific target if --build is passed or docker compose build

so you can use target to stop at different places in one build context if you have like a web container, a queue container, etc.



Log in to leave a note.