diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6c32d349251d3370c0953f6bc55962d860822239..700bf0b119fd4a5f24c3dfcf941b2120464d4cd8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ that users understand how the changes affect the new version.
 
 version 5.0.0-dev
 ---------------------------
++ bcftools: add tmpDir input to specify temporary directory when sorting.
 + bcftools: remove outputType and implement indexing based on output file extension. 
 + NanoPack: Add parameter_meta to NanoPlot task.
 + Centrifuge: Remove metrics file from classification (which causes the
diff --git a/bcftools.wdl b/bcftools.wdl
index e2251331254c8f7d0f4ce44f19f677f0a9b67056..63f2cacb7a1fcc75e85e864cea2258b4c82d57e6 100644
--- a/bcftools.wdl
+++ b/bcftools.wdl
@@ -127,6 +127,7 @@ task Sort {
     input {
         File inputFile
         String outputPath = "output.vcf.gz"
+        String tmpDir = "./sorting-tmp"
         String memory = "256M"
         Int timeMinutes = 1 + ceil(size(inputFile, "G"))
         String dockerImage = "quay.io/biocontainers/bcftools:1.10.2--h4f4756c_2"
@@ -136,10 +137,11 @@ task Sort {
 
     command {
         set -e
-        mkdir -p "$(dirname ~{outputPath})"
+        mkdir -p "$(dirname ~{outputPath})" ~{tmpDir}
         bcftools sort \
         -o ~{outputPath} \
         -O ~{true="z" false="v" compressed} \
+        -T ~{tmpDir} \
         ~{inputFile}
 
         ~{if compressed then 'bcftools index --tbi ~{outputPath}' else ''}