Docker is still helpful even when you want to compile for source. Something that's simple with containers but maddening on bare metal is build or runtime configs where different versions of packed/libraries are required. A container lets you have a super customized build environment for a single application that can spit out a binary that'll run on bare metal but might otherwise pollute the machine's build config.
Some languages make building harder than others but containers can obviate a lot of that difficulty even if the runtime target is bare metal.