The issue is likely caused by gdal2tiles.py
producing too much output, which fills up the Python subprocess output buffers and causes it to hang silently. Even with a timeout set, the process won’t exit if those buffers are full. To fix this, remove capture_output=True
from your subprocess.run
call so the output flows directly to the terminal and doesn't get stuck. This usually resolves the deadlock when running GDAL tools inside a Docker container.