The multi-stage build functionality is currently in the version 17.05 of Docker. Download the binaries and reload the Docker instance to load the latest version.
Download the latest development build from the Docker build server.
curl -L https://master.dockerproject.org/linux/amd64/dockerd-17.05.0-dev -o dockerd
mv dockerd /usr/bin/dockerd && chmod +x /usr/bin/dockerd
Restart to load the new server.
systemctl restart docker
You can now use the multi-stage build functionality. Note: This is still in beta and not recommended for production.