Я просто попробовал это для себя, все, что нужно сделать.
Возможно, ужасная практика, но функциональная.
import os
cwd = os.getcwd() # gets directory of docker environment
sys.path.append(cwd)
testfile = cwd + '/testfile.txt'
with open(testfile, 'w') as tf:
tf.write('Hello World')
with open(testfile, 'r') as tf2:
print(tf2.read())