diff --git a/run-docker.sh b/run-docker.sh
index 5fc4c2edad2d979b000c02f477e9087f0cfca31c..7dcabb20c0f59b6d2a1dde1e5fc74b747fc69bcc 100755
--- a/run-docker.sh
+++ b/run-docker.sh
@@ -30,6 +30,7 @@ CNPY_LOCAL=$SCRIPTPATH/cnpy
 FINN_HLS_LOCAL=$SCRIPTPATH/finn-hlslib
 PYVERILATOR_LOCAL=$SCRIPTPATH/pyverilator
 PYNQSHELL_LOCAL=$SCRIPTPATH/PYNQ-HelloWorld
+BUILD_LOCAL=/tmp/finn
 VIVADO_HLS_LOCAL=$VIVADO_PATH
 
 # clone dependency repos
@@ -40,6 +41,9 @@ git clone $FINN_HLS_REPO $FINN_HLS_LOCAL; git -C "$FINN_HLS_LOCAL" checkout b5dc
 git clone $PYVERILATOR_REPO $PYVERILATOR_LOCAL ||  git -C "$PYVERILATOR_LOCAL" pull
 git clone $PYNQSHELL_REPO $PYNQSHELL_LOCAL ||  git -C "$PYNQSHELL_LOCAL" pull
 
+# ensure build dir exists locally
+mkdir -p $BUILD_LOCAL
+
 echo "Mounting $SCRIPTPATH into /workspace/finn"
 echo "Mounting $SCRIPTPATH/brevitas into /workspace/brevitas"
 echo "Mounting $SCRIPTPATH/brevitas_cnv_lfc into /workspace/brevitas_cnv_lfc"
@@ -47,6 +51,7 @@ echo "Mounting $SCRIPTPATH/cnpy into /workspace/cnpy"
 echo "Mounting $SCRIPTPATH/finn-hlslib into /workspace/finn-hlslib"
 echo "Mounting $SCRIPTPATH/pyverilator into /workspace/pyverilator"
 echo "Mounting $SCRIPTPATH/PYNQ-HelloWorld into /workspace/PYNQ-HelloWorld"
+echo "Mounting $BUILD_LOCAL into $BUILD_LOCAL"
 echo "Mounting $VIVADO_PATH into $VIVADO_PATH"
 
 if [ "$1" = "test" ]; then
@@ -78,6 +83,7 @@ docker run --rm --name finn_dev -it \
 -v $SCRIPTPATH/finn-hlslib:/workspace/finn-hlslib \
 -v $SCRIPTPATH/pyverilator:/workspace/pyverilator \
 -v $SCRIPTPATH/PYNQ-HelloWorld:/workspace/PYNQ-HelloWorld \
+-v $BUILD_LOCAL:$BUILD_LOCAL \
 -v $VIVADO_PATH:$VIVADO_PATH \
 -e VIVADO_PATH=$VIVADO_PATH \
 -p 8888:8888 -p 8081:8081 \
diff --git a/src/finn/core/utils.py b/src/finn/core/utils.py
index 7f85b244545232979638148e10ae07edc8795b3b..7f39c64753c784c1c17d72718437870cf8a65bb4 100644
--- a/src/finn/core/utils.py
+++ b/src/finn/core/utils.py
@@ -2,13 +2,19 @@ import random
 import string
 import subprocess
 import os
-
 import numpy as np
 import onnx
+import tempfile
 from bitstring import BitArray
 
 from finn.core.datatype import DataType
 
+def make_build_dir(prefix=""):
+    """Creates a temporary folder with given prefix to be used as a build dir.
+    Use this function instead of tempfile.mkdtemp to ensure any generated files
+    will survive on the host after the FINN Docker container exits."""
+
+    return tempfile.mkdtemp(prefix="finn/"+prefix)
 
 def valueinfo_to_tensor(vi):
     """Creates an all-zeroes numpy tensor from a ValueInfoProto."""
@@ -276,4 +282,3 @@ class IPGenBuilder:
         bash_command = ["bash", self.ipgen_script]
         process_compile = subprocess.Popen(bash_command, stdout=subprocess.PIPE)
         process_compile.communicate()
-        
diff --git a/src/finn/transformation/fpgadataflow/codegen_ipgen.py b/src/finn/transformation/fpgadataflow/codegen_ipgen.py
index 0159873a3b80abeea277d4c8ec16dbf3a23779e2..13686f846c7ee9893dd0ad7d12add79402599efb 100644
--- a/src/finn/transformation/fpgadataflow/codegen_ipgen.py
+++ b/src/finn/transformation/fpgadataflow/codegen_ipgen.py
@@ -1,8 +1,7 @@
 import os
-import tempfile as tmp
 
 import finn.custom_op.registry as registry
-from finn.core.utils import get_by_name
+from finn.core.utils import get_by_name, make_build_dir
 from finn.transformation import Transformation
 
 
@@ -17,7 +16,7 @@ def _codegen_single_node(node, model, fpgapart, clk):
         code_gen_dir = inst.get_nodeattr("code_gen_dir_ipgen")
         # ensure that there is a directory
         if code_gen_dir == "" or not os.path.isdir(code_gen_dir):
-            code_gen_dir = tmp.mkdtemp(
+            code_gen_dir = make_build_dir(
                 prefix="code_gen_ipgen_" + str(node.op_type) + "_"
             )
             inst.set_nodeattr("code_gen_dir_ipgen", code_gen_dir)
diff --git a/src/finn/transformation/fpgadataflow/codegen_ipstitch.py b/src/finn/transformation/fpgadataflow/codegen_ipstitch.py
index 138556ce8b928bc5a21166b53513d6c439221cfe..e4c303f847940bb00bfe86bd917535ba477891a6 100644
--- a/src/finn/transformation/fpgadataflow/codegen_ipstitch.py
+++ b/src/finn/transformation/fpgadataflow/codegen_ipstitch.py
@@ -1,8 +1,7 @@
 import os
 import subprocess
-import tempfile as tmp
 
-from finn.core.utils import get_by_name
+from finn.core.utils import get_by_name, make_build_dir
 from finn.transformation import Transformation
 
 
@@ -90,7 +89,7 @@ class CodeGen_ipstitch(Transformation):
                 )
 
         # create a temporary folder for the project
-        vivado_stitch_proj_dir = tmp.mkdtemp(prefix="vivado_stitch_proj_")
+        vivado_stitch_proj_dir = make_build_dir(prefix="vivado_stitch_proj_")
         model.set_metadata_prop("vivado_stitch_proj", vivado_stitch_proj_dir)
         # start building the tcl script
         tcl = []
diff --git a/src/finn/transformation/fpgadataflow/codegen_npysim.py b/src/finn/transformation/fpgadataflow/codegen_npysim.py
index 0d5a42dfe3f0b47aa9201175177ed9c242e9dfbe..51a7c5bb8257afbf8cadda11c97e87ef2c12e725 100644
--- a/src/finn/transformation/fpgadataflow/codegen_npysim.py
+++ b/src/finn/transformation/fpgadataflow/codegen_npysim.py
@@ -1,8 +1,7 @@
 import os
-import tempfile as tmp
 
 import finn.custom_op.registry as registry
-from finn.core.utils import get_by_name
+from finn.core.utils import get_by_name, make_build_dir
 from finn.transformation import Transformation
 
 
@@ -17,7 +16,7 @@ def _codegen_single_node(node, model):
         code_gen_dir = inst.get_nodeattr("code_gen_dir_npysim")
         # ensure that there is a directory
         if code_gen_dir == "" or not os.path.isdir(code_gen_dir):
-            code_gen_dir = tmp.mkdtemp(
+            code_gen_dir = make_build_dir(
                 prefix="code_gen_npysim_" + str(node.op_type) + "_"
             )
             inst.set_nodeattr("code_gen_dir_npysim", code_gen_dir)
diff --git a/src/finn/transformation/fpgadataflow/make_pynq_proj.py b/src/finn/transformation/fpgadataflow/make_pynq_proj.py
index 5358053a7670bfea78e8802999b405d8ecdc4741..ac9ff67dbff490f36971ce0e73a3910bacf99d59 100644
--- a/src/finn/transformation/fpgadataflow/make_pynq_proj.py
+++ b/src/finn/transformation/fpgadataflow/make_pynq_proj.py
@@ -1,8 +1,7 @@
 import os
 import subprocess
-import tempfile as tmp
 
-from finn.core.utils import get_by_name
+from finn.core.utils import get_by_name, make_build_dir
 from finn.transformation import Transformation
 
 
@@ -58,7 +57,7 @@ class MakePYNQProject(Transformation):
         nrst_name = "ap_rst_n_0"
 
         # create a temporary folder for the project
-        vivado_pynq_proj_dir = tmp.mkdtemp(prefix="vivado_pynq_proj_")
+        vivado_pynq_proj_dir = make_build_dir(prefix="vivado_pynq_proj_")
         model.set_metadata_prop("vivado_pynq_proj", vivado_pynq_proj_dir)
 
         ip_config_tcl = """
diff --git a/tests/fpgadataflow/test_npy2hls.py b/tests/fpgadataflow/test_npy2hls.py
index 47b4eb4103b83664e83c10bcc7f867996e52a5e4..775b486c0ac3c9b9354f33b28127b00adc694af6 100644
--- a/tests/fpgadataflow/test_npy2hls.py
+++ b/tests/fpgadataflow/test_npy2hls.py
@@ -1,6 +1,5 @@
 import shutil
 import subprocess
-import tempfile as tmp
 
 import numpy as np
 
@@ -10,7 +9,7 @@ from finn.core.datatype import DataType
 
 
 def make_npy2apintstream_testcase(ndarray, dtype):
-    test_dir = tmp.mkdtemp(prefix="test_npy2apintstream_")
+    test_dir = make_build_dir(prefix="test_npy2apintstream_")
     shape = ndarray.shape
     elem_bits = dtype.bitwidth()
     packed_bits = shape[-1] * elem_bits