idmtools_platform_local.infrastructure.base_service_container module¶
-
class
idmtools_platform_local.infrastructure.base_service_container.
BaseServiceContainer
(container_name: str = None, image: str = None, client: docker.client.DockerClient = None, config_prefix: str = None, network: str = None)¶ Bases:
abc.ABC
-
container_name
: str = None¶
-
image
: str = None¶
-
client
: docker.client.DockerClient = None¶
-
config_prefix
: str = None¶
-
network
: str = None¶
-
static
get_common_config
(container_name: str, image: str, network: str, port_bindings: Optional[Dict] = None, volumes: Optional[Dict] = None, mem_limit: Optional[str] = None, mem_reservation: Optional[str] = None, environment: Optional[List[str]] = None, extra_labels: Optional[Dict] = None, **extras) → dict¶ Returns portions of docker container configs that are common between all the different containers used within our platform
- Parameters
mem_limit (Optional[str]) – Limit memory
mem_reservation (Optional[str]) – Reserve memory
Returns:
Notes
Memory strings should match those used by docker. See –memory details at https://docs.docker.com/engine/reference/run/#runtime-constraints-on-resources
-
get
() → Optional[docker.models.containers.Container]¶
-
get_or_create
(spinner=None) → docker.models.containers.Container¶ Get or Create a container
- Parameters
spinner – Optional spinner to display
- Returns
Docker container object representing service container
-
ensure_container_is_running
(container: docker.models.containers.Container, spinner=None) → docker.models.containers.Container¶ Ensures is running :param container:
Returns:
-
has_different_config
(container, show_diff: bool = True)¶ Detect if the config is difference that running container
- Parameters
container – Container
show_diff – Should we diplay diff
Returns:
-
get_running_config
(container)¶ Fetches the config used to start a container :param container:
Returns:
-
static
copy_config_to_container
(container: docker.models.containers.Container, config: dict)¶
-
create
(spinner=None) → docker.models.containers.Container¶
-
static
wait_on_status
(container, sleep_interval: float = 0.2, max_time: float = 2, statutes_to_wait_for: List[str] = None)¶
-
stop
(remove=False, container: docker.models.containers.Container = None)¶
-
restart
(container: docker.models.containers.Container = None)¶
-
get_logs
()¶
-
abstract
get_configuration
() → Dict¶
-