Multi-stage builds are a new feature requiring Docker 17.05 or higher on the daemon and client. Multistage builds are useful to anyone who has struggled to optimize Dockerfiles while keeping them easy to read and maintain.
docker build --target dev -t python-app:dev .
docker build --target prod -t python-app:prod .
DOCKER_BUILDKIT=1 docker build --target dev -t python-app:dev .
DOCKER_BUILDKIT=1 docker build --target prod -t python-app:prod .