LocalDockerInstance
#
- class ansys.geometry.core.connection.docker_instance.LocalDockerInstance(port: int = DEFAULT_PORT, connect_to_existing_service: bool = True, restart_if_existing_service: bool = False, name: str | None = None, image: GeometryContainers | 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
Modeler
interface to connect to (if it is already deployed). By default, the value is the one for theDEFAULT_PORT
connection parameter.- connect_to_existing_servicebool, default:
True
Whether the
Modeler
interface 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
str
orNone
, default:None
Name of the Docker container to deploy. The default is
None
, in which case Docker assigns it a random name.- image
GeometryContainers
orNone
, default:None
The Geometry service Docker image to deploy. The default is
None
, in which case theLocalDockerInstance
class identifies the OS of your Docker engine and deploys the latest version of the Geometry service for that OS.
- 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:
DockerClient
Initialized Docker client.
Notes
The
LocalDockerInstance
class performs a lazy initialization of the__DOCKER_CLIENT__
class variable.