简体   繁体   中英

Running python in read-only Docker container

I have a web app that I want to run using Docker container with nginx. As I know, it is suggested that I use read-only container for security purposes, but when I run my app on local machine, it always generates __pycache__ folder. Will it be a problem when running in read-only environment? If yes, how to solve it?

You can start Python with the -B argument:

python -B myscript.py

This turns off writing .pyc and .pyo files when you import .py files.

Alternatively, you set and environmental variable:

PYTHONDONTWRITEBYTECODE=x

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM