.. _object_DockerService: :index:`DockerService` ---------------------- Description *********** The DockerService object is a :ref:`SystemService ` which manages Docker containers. On instantiation it initializes all :ref:`DockerObject ` objects attached to its :ref:`containers ` and starts all enabled :ref:`containers ` afterards. :**› Inherits**: :ref:`SystemService ` Overview ******** Properties ++++++++++ .. hlist:: :columns: 2 * :ref:`bridgeIp ` * :ref:`containers ` * :ref:`error ` * :ref:`errorString ` * :ref:`password ` * :ref:`registry ` * :ref:`username ` * :ref:`SystemService.description ` * :ref:`SystemService.enabled ` * :ref:`SystemService.name ` * :ref:`SystemService.running ` * :ref:`SystemService.timeout ` * :ref:`Object.objectId ` * :ref:`Object.parent ` Methods +++++++ .. hlist:: :columns: 2 * :ref:`login() ` * :ref:`logout() ` * :ref:`removeAllFiles() ` * :ref:`removeAllFilesExceptVolumes() ` * :ref:`SystemService.restart() ` * :ref:`SystemService.start() ` * :ref:`SystemService.stop() ` * :ref:`Object.deserializeProperties() ` * :ref:`Object.fromJson() ` * :ref:`Object.serializeProperties() ` * :ref:`Object.toJson() ` Signals +++++++ .. hlist:: :columns: 1 * :ref:`containersDataChanged() ` * :ref:`errorOccurred() ` * :ref:`Object.completed() ` Enumerations ++++++++++++ .. hlist:: :columns: 1 * :ref:`Error ` Properties ********** .. _property_DockerService_bridgeIp: .. _signal_DockerService_bridgeIpChanged: .. index:: single: bridgeIp bridgeIp ++++++++ This property holds an IP address including an IP prefix to use for the ``docker0`` bridge. This property was introduced in InCore 1.1. :**› Type**: String :**› Default**: ``172.17.0.0/16`` :**› Signal**: bridgeIpChanged() :**› Attributes**: Writable .. _property_DockerService_containers: .. _signal_DockerService_containersChanged: .. index:: single: containers containers ++++++++++ This property holds a list of Docker containers to manage and start. :**› Type**: :ref:`List `\<:ref:`DockerContainer `> :**› Signal**: containersChanged() :**› Attributes**: Readonly .. _property_DockerService_error: .. _signal_DockerService_errorChanged: .. index:: single: error error +++++ This property holds the most recently occurred error or :ref:`DockerContainer.NoError ` if no error occurred. If the same error occurs multiple times this property does not change. Use the :ref:`errorOccurred() ` signal to detect multiple occurrences of the same error. :**› Type**: :ref:`Error ` :**› Signal**: errorChanged() :**› Attributes**: Readonly .. _property_DockerService_errorString: .. _signal_DockerService_errorStringChanged: .. index:: single: errorString errorString +++++++++++ This property holds the current human readable error string corresponding to the current value in the :ref:`error ` property. It may include additional information such as failure reasons or locations. :**› Type**: String :**› Signal**: errorStringChanged() :**› Attributes**: Readonly .. _property_DockerService_password: .. _signal_DockerService_passwordChanged: .. index:: single: password password ++++++++ This property holds the password used to login to the Docker :ref:`registry `. This property was introduced in InCore 1.1. :**› Type**: String :**› Signal**: passwordChanged() :**› Attributes**: Writable .. _property_DockerService_registry: .. _signal_DockerService_registryChanged: .. index:: single: registry registry ++++++++ This property holds the name of a registry, i.e. the server name, to login with :ref:`username ` and :ref:`password `. See the `official Docker documentation on docker login `_ for details. This property was introduced in InCore 1.1. :**› Type**: String :**› Signal**: registryChanged() :**› Attributes**: Writable .. _property_DockerService_username: .. _signal_DockerService_usernameChanged: .. index:: single: username username ++++++++ This property holds the username used to login to the Docker :ref:`registry `. This property was introduced in InCore 1.1. :**› Type**: String :**› Signal**: usernameChanged() :**› Attributes**: Writable Methods ******* .. _method_DockerService_login: .. index:: single: login login() +++++++ This method logs in to a Docker :ref:`registry `. This method is called on instantiation automatically and usually does not have to be called manually. It returns ``true`` if the login was successful. Otherwise ``false`` is returned and :ref:`error ` is set to :ref:`DockerService.LoginError `. This method was introduced in InCore 1.1. :**› Returns**: Boolean .. _method_DockerService_logout: .. index:: single: logout logout() ++++++++ This method logs out from a Docker :ref:`registry `. This method was introduced in InCore 1.1. .. _method_DockerService_removeAllFiles: .. index:: single: removeAllFiles removeAllFiles() ++++++++++++++++ This method completely removes all Docker-related data, i.e. containers, images, volumes and orphaned files. This method was introduced in InCore 2.9. :**› Returns**: Boolean .. _method_DockerService_removeAllFilesExceptVolumes: .. index:: single: removeAllFilesExceptVolumes removeAllFilesExceptVolumes() +++++++++++++++++++++++++++++ This method removes all Docker-related persistent data, i.e. containers, images and orphaned files but keeps volumes. This method was introduced in InCore 2.9. :**› Returns**: Boolean Signals ******* .. _signal_DockerService_containersDataChanged: .. index:: single: containersDataChanged containersDataChanged(SignedInteger index) ++++++++++++++++++++++++++++++++++++++++++ This signal is emitted whenever the :ref:`List.dataChanged() ` signal is emitted, i.e. the item at ``index`` in the :ref:`containers ` list itself emitted the dataChanged() signal. .. _signal_DockerService_errorOccurred: .. index:: single: errorOccurred errorOccurred() +++++++++++++++ This signal is emitted whenever an error has occurred, regardless of whether the :ref:`error ` property has changed or not. In contrast to the change notification signal of the :ref:`error ` property this signal is also emitted several times if a certain error occurs several times in succession. Enumerations ************ .. _enum_DockerService_Error: .. index:: single: Error Error +++++ This enumeration describes all errors which can occur in DockerContainer objects. The most recently occurred error is stored in the :ref:`error ` property. .. index:: single: DockerService.NoError .. index:: single: DockerService.LoginError .. list-table:: :widths: auto :header-rows: 1 * - Name - Value - Description .. _enumitem_DockerService_NoError: * - ``DockerService.NoError`` - ``0`` - No error occurred or was detected. .. _enumitem_DockerService_LoginError: * - ``DockerService.LoginError`` - ``1`` - Docker registry login failed, likely due to invalid credentials. Example ******* See :ref:`DockerContainer example ` on how to use DockerService.