Docker general workflow with vsc

I am a new user of docker and I have some questions about Docker workflow.
I know these two workflows:

I work with codebase on my host machine. And every time when I want to build code and run an application I type:

  • docker build …
  • docker run …
    I think that is not the most comfortable approach

The second workflow is working with visual studio code in running containers.
The pros are:

  • I see all dependencies in visual studio code (because I working inside a container)
  • I need only restart container to recompile my changes
    But I see big cons:
  • When I save the invalid file in the container I cannot start it. And I cannot change this invalid file because I need running container to change file.

Can anyone share knowledge about workflow with docker?