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
-
static
ensure_container_is_running
(container: docker.models.containers.Container) → docker.models.containers.Container¶ Ensures is running :param container:
Returns:
-
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)¶
-
restart
()¶
-
get_logs
()¶
-
abstract
get_configuration
() → Dict¶
-