Skip to content

Hot Reloading for FastAPI Docker Debugger #3362

Answered by bwateratmsft
kasperschnack asked this question in Q&A
Discussion options

You must be logged in to vote

Changing this over to a Discussion.

There's one important additional step required aside from adding --reload. By default, the Dockerfile will cause the app code to be copied into the container--modifying it on the source will not modify it in the container until the image is rebuilt. You can override this by adding the following to the docker-run task in tasks.json, in addition to the --reload argument:

"dockerRun": {
    "volumes": [
        {
            "containerPath": "/app",
            "localPath": "${workspaceFolder}"
        }
    ]
}

Here's my full tasks.json file:

tasks.json
{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "docker-build",
            "la…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@kasperschnack
Comment options

@kasperschnack
Comment options

@bwateratmsft
Comment options

Answer selected by bwateratmsft
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants
Converted from issue

This discussion was converted from issue #3359 on January 03, 2022 15:56.