Docker Instances

A Docker instance is the term used to refer to an instance created on a Docker node. These instances exist within their own Docker containers, with the lifecycle of these containers being tied to the instance it was created for.

Managing an Instance

Docker instances should be manageable in much the same way as any other instance. Deployment of applications, assignation to Deployment Groups, editing of config, should all be done just as if the instance was a standard SSH or CONFIG instance.

Creating an Instance

Creating a Docker instance is done in exactly the same way as when creating a normal one: with the create-instance command.

asadmin create-instance --node DockerNode1 dockerInstance1

When you invoke this command, a Docker container of the same name will be created. If a Docker container of the same name already exists, the create-instance command will fail, and Payara Server will attempt to unregister the instance from the DAS.

Please note that it is required that secure-admin be enabled for Docker instances to start (which is why a passwordfile is mandatory when creating a Docker node).

Starting an Instance

Starting a Docker instance should be done just as if it were an instance on an SSH node. When the start-instance command is invoked, the DAS will contact the Docker Rest API as configured in the node config, and start the Docker container and the instance within it.

asadmin start-instance DockerInstance1

Deleting an Instance

Much as with when creating a Docker instance, deleting a Docker instance is done in the same way as other instances: with the delete-instance command. This will unregister the instance from the DAS, and delete the Docker container.

asadmin delete-instance DockerInstance1

Configuring the Docker Container

Configuration of the Docker containers is done via system properties in an instances config (and so can be shared across multiple instances).

A complete list of the available configuration options can be found in the Docker Engine REST API here: https://docs.docker.com/engine/api/v1.39/#operation/ContainerCreate

The container and image name are not configurable - Payara Server expects the container and image names to match the value from the instance & node config

The configuration within Payara Server of the settings denoted in the above link takes the form of dotted names. These names adhere to the following syntax:

  • Each property is prepended with "Docker"

  • Each child object is specified individually, with all of its parents prepended to it

  • Arrays must be surrounded with square braces

  • Array values are separated using the vertical bar symbol "|"

  • The colon character is used to denote the value of an object within an array

  • Objects within an array are separated using a comma

Properties that are denoted by arrays of objects containing further objects or arrays are not currently supported. The Env property is unique in that the colon character is used to denote the equals sign, as Payara Server does not currently support properties that contain an equals in their value.

See below for some examples:

Example Original JSON Payara System Properties

Arrays must be surrounded with square braces & array values separated using the vertical bar symbol "|"

{ENV: [arg1=foo,arg2=bar]}

Docker.Env=[arg1:foo|arg2:bar]

Each child object of a parent object is specified individually

{HostConfig: {Memory: 2048, CpuShares: 3}}

Docker.HostConfig.Memory=2048 Docker.HostConfig.CpuShares=3

The colon character is used to denote the value of an object within an array & objects within an array are separated using a comma

{HostConfig: {BlkioDeviceReadBps: [{Path: /opt/foo, Rate: 24},{Path: /opt/bar, Rate: 48}]}}

Docker.HostConfig.BlkioDeviceReadBps=[Path:/opt/foo,Rate:24|Path:/opt/bar,Rate:48]

Payara Server assumes that the network mode in use is bridged - it expects to be able to talk to each instance using the port listed in its config

results matching ""

    No results matching ""