Home>

On the server will turn back back on FastAPI. The Compose Docker file is prescribed the following flags

Version: '3'
Services:
  Project:
    Build :.
    Restart: Always
    Network_Mode: Host.
    Command: >
        Bash -C "Uvicorn Main: App"
    Volumes:
    -/home /some_dir: /app

Do I understand correctly that when rewriting a Main file, the whole project will automatically restart?

  • Answer # 1

    No, will not restart.

    Parameter

    Restart: Always
    

    means that Docker-Compose Restarts the container if he suddenly stop (for example, the program will finish the execution of second or emergency). This option is needed precisely for restarting if suddenly fails, and not to deploy the new version.

    It is also important to understand that when the program is completed for any reason, then Restart: Always will not force Docker-Compose re-made Build . A new docker will not be created, and the existing one will be used. If the source code of the application falls into the container when assembling an image of the dock, then in this case an old image will be used to change. If the source code falls through the Volume, the changes made in them picked up.

    If the program is executed and does not stop, the file substitution will not give anything.

  • Answer # 2

    No, will not restart.

    Parameter

    Restart: Always
    

    means that Docker-Compose Restarts the container if he suddenly stop (for example, the program will finish the execution of second or emergency). This option is needed precisely for restarting if suddenly fails, and not to deploy the new version.

    It is also important to understand that when the program is completed for any reason, then Restart: Always will not force Docker-Compose re-made Build . A new docker will not be created, and the existing one will be used. If the source code of the application falls into the container when assembling an image of the dock, then in this case an old image will be used to change. If the source code falls through the Volume, the changes made in them picked up.

    If the program is executed and does not stop, the file substitution will not give anything.