Workflow with docker in the development environment
We use kubernetes / minikube rather than docker-compose, but its the same problem. 
We generally go with option #1 as:


Development is 99% getting the app right.
You want to be able to iterate fast/freely with your app.
You want easy use of your debugger / IDE without inhibition.
It lets you avoid configuring / managing remote debuggers from within the docker container.


If you did this in the container, you'd have to worry about making sure you didn't actually put it in prod as it can be harmful; see below.



For most code changes, we actually just have GitLab-CI set up so that it test-builds/deploys the container/app on check in (on their own branch/space).  That way, most developers don't even need to think about the container part unless they're making mods to that area.  But, obviously you'd still want them being able to run the MySQL container locally and easily.

Remote Debugging Info

https://jaxenter.com/remote-debugging-java-applications-151466.html


  Warning: Don’t keep remote debugging JVM arguments ON always, as it has following downsides:
  
  Remote debugging mode disables several optimizations that JVM does to application to optimize the performance. All those optimizations will be lost.
  Remote debugging opens up a port. It’s a security risk, as anyone who can hit the server can initiate remote debugging