LocalDockerInstance#
- class ansys.geometry.core.connection.docker_instance.LocalDockerInstance(port: int = pygeom_defaults.DEFAULT_PORT, connect_to_existing_service: bool = True, restart_if_existing_service: bool = False, name: str | None = None, image: GeometryContainers | None = None, transport_mode: str | None = None, certs_dir: pathlib.Path | str | None = None)#
Instantiates a Geometry service as a local Docker container.
By default, if a container with the Geometry service already exists at the given port, PyAnsys Geometry connects to it. Otherwise, PyAnsys Geometry tries to launch its own service.
- Parameters:
- port
int,optional Localhost port to deploy the Geometry service on or the the
Modelerinterface to connect to (if it is already deployed). By default, the value is the one for theDEFAULT_PORTconnection parameter.- connect_to_existing_servicebool, default:
True Whether the
Modelerinterface should connect to a Geometry service already deployed at the specified port.- restart_if_existing_servicebool, default:
False Whether the Geometry service (which is already running) should be restarted when attempting connection.
- name
strorNone, default:None Name of the Docker container to deploy. The default is
None, in which case Docker assigns it a random name.- image
GeometryContainersorNone, default:None The Geometry service Docker image to deploy. The default is
None, in which case theLocalDockerInstanceclass identifies the OS of your Docker engine and deploys the latest version of the Geometry service for that OS.- transport_mode
str|None Transport mode selected, by default None and thus it will be selected for you based on the connection criteria. Options are: “insecure”, “mtls”
- certs_dir
Path|str|None Directory to use for TLS certificates. By default None and thus search for the “ANSYS_GRPC_CERTIFICATES” environment variable. If not found, it will use the “certs” folder assuming it is in the current working directory.
- port
Overview#
Docker container object that hosts the deployed Geometry service. |
|
Flag indicating whether the container previously existed. |
Docker client class variable. |
Get the initialized |
|
Check a local installation of Docker engine is available and running. |
Import detail#
from ansys.geometry.core.connection.docker_instance import LocalDockerInstance
Property detail#
- property LocalDockerInstance.container: docker.models.containers.Container#
Docker container object that hosts the deployed Geometry service.
Attribute detail#
- LocalDockerInstance.__DOCKER_CLIENT__: docker.client.DockerClient = None#
Docker client class variable.
Notes
The default is
None, in which case lazy initialization is used.__DOCKER_CLIENT__is a class variable, meaning that it is the same variable for all instances of this class.
Method detail#
- static LocalDockerInstance.docker_client() docker.client.DockerClient#
Get the initialized
__DOCKER_CLIENT__object.- Returns:
DockerClientInitialized Docker client.
Notes
The
LocalDockerInstanceclass performs a lazy initialization of the__DOCKER_CLIENT__class variable.