optimize restore & use Getenv less in daemon.go

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
Merge pull request #6121 from unclejack/refactor_daemon_restore

optimize restore & use Getenv less in daemon.go