import os os.environ['ENV_VAR']="True" my_env =None if bool(my_env): <h1>// if my_env: gives the same result</h1> <h1>Env exists</h1> print("ok") else: pass <h1>Env not set</h1>
Docker can enforce hard memory limits, which allow the container to use no more than a given amount of user or system memory, or soft limits, which allow the container to use as much memory as it needs unless certain conditions are met, such as when the kernel detects low memory or contention on the host machine. Some of these options have different effects when used alone or when more than one option is set.
Most of these options take a positive integer, followed by a suffix of
g, to indicate bytes, kilobytes, megabytes, or gigabytes.
The maximum amount of memory the container can use. If you set this option, the minimum allowed value is
4m (4 megabyte).
The amount of memory this container is allowed to swap to disk. See
By default, the host kernel can swap out a percentage of anonymous pages used by a container. You can set
--memory-swappiness to a value between 0 and 100, to tune this percentage. See
Allows you to specify a soft limit smaller than
--memory which is activated when Docker detects contention or low memory on the host machine. If you use
--memory-reservation, it must be set lower than
--memory for it to take precedence. Because it is a soft limit, it does not guarantee that the container doesn’t exceed the limit.
The maximum amount of kernel memory the container can use. The minimum allowed value is
4m. Because kernel memory cannot be swapped out, a container which is starved of kernel memory may block host machine resources, which can have side effects on the host machine and on other containers. See
By default, if an out-of-memory (OOM) error occurs, the kernel kills processes in a container. To change this behavior, use the
--oom-kill-disable option. Only disable the OOM killer on containers where you have also set the
-m/--memory option. If the
-m flag is not set, the host can run out of memory and the kernel may need to kill the host system’s processes to free memory.