from typing import Dict
from typing import List
from typing import Optional


def extract_env_var(
    container: Dict[str, List[Dict[str, str]]], name: str
) -> Optional[str]:
    """Extract env var from container definition.

    Args:
        container: Container definition.
        name: Name of the environment variable.

    Returns:
        Enviornment variable value or `None` if var is not found.
    """

    for entry in container.get("environment", []):
        if entry["name"] == name:
            return entry["value"]
    return None