Twelve-Factor app with Docker

How to build an application bundled in Docker image to be compliant with all rules of Twelve-Factor App. Why you should forward all application logs to STDOUT. Why you should use the same Docker image in all environments. How to run one-time commands.