docker: implemented usePlatformImage.
docker: using usePlatformImage on getImage.
removing flatten.

\o/
docker: removing image when usePlatformImage is true.
removed unused write.
fixed some bugs.