Managing Containers

Starting a Container

To start a container:

Command:

gs.{sh/bat} container start <host>

Description:

This commands starts a container.

Input Example:

<GS_HOME>/bin/gs container start myHost
<GS_HOME>/bin/gs.sh container start myHost

Parameters and Options:

Item Name Description
Parameter host Provide the name of the host where the container should be started.
Option —memory:<memory> Define the maximum amount of JVMClosed Java Virtual Machine. A virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. memory for the new container.
Option —zone=<zone name> Define the zone where the new container should be started.
Option —property=<String=String> Provide additional system properties.

Path

POST /containers

Description:

This option starts a container.

Example Request:

curl -X POST --header 'Content-Type: application/json' --header 'Accept: text/plain' -d '{ \ 
   "host": "myHost", \ 
   "memory": "12g", \ 
   "zone": "green", \ 
 }' 'http://localhost:8090/v2/containers'

Options:

Option Description Required
memory Define the maximum amount of JVM memory for the new container. No
zone Define the zone where the new container should be started. No
vmArguments Provide additional system properties.
  1. In the Hosts view, click the Actions icon for the Grid Service Agent where you want to start a container.
  2. Select the relevant option:

    The container is started.

If you try to start a global container that is already running under this Grid Service Agent, you get a notification message and the container isn't started.

Refer to the Admin API topics in the Developer Guide.

Terminating a Container

To terminate a container:

Command:

xgs.{sh/bat} container kill <container ID>

Description:

This command stops (terminates) the specified container.

Input Example:

<GS_HOME>/bin/gs container kill admin~22200
<GS_HOME>/bin/gs.sh container kill admin~22200

Parameters and Options:

Item Name Description
Parameter container ID ID of the container to be terminated.
Option zones Specify the zone(s) where the container should be terminated.

Path

DELETE /containers/{id}

Description:

This option stops (terminates) the specified container.

Example Request:

curl -X DELETE --header 'Accept: text/plain' 'http://localhost:8090/v2/containers/admin~13972'

Options:

Option Description Required
containerId ID of the container to be terminated. Yes
  1. In the Hosts view, expand the tree.
  2. In the row with the required container, click the Actions icon and select Terminate from the menu.
  3. Click Yes in the confirmation message.
  4. Click OK.

The container is terminated. The Host view and the status bar at the bottom of the window are updated.

If you terminated a global container, it is started again with a new name.

Refer to the Admin API topics in the Developer Guide.

Restarting a Container

To restart a container:

Command:

gs.{sh/bat} container restart <container ID>

Description:

This command restarts the specified container.

Input Example:

<GS_HOME>/bin/gs container restart admin~11100
<GS_HOME>/bin/gs.sh container restart admin~11100

Parameters and Options:

Item Name Description
Parameter container ID ID of the container to be restarted.

Path

DELETE /containers/{id}/restart

Description:

This option restarts the specified container.

Example Request:

curl -X POST --header 'Content-Type: application/json' --header 'Accept: text/plain' 'http://localhost:8090/v2/containers/admin~13972/restart'

Options:

Option Description Required
containerId ID of the container to be restarted. Yes
  1. In the Hosts view, expand the tree.
  2. In the row with the required container, click the Actions icon and select Restart from the menu.
  3. Click Yes in the confirmation message.
  4. Click OK.

The container is terminated and restarted with the same name. The Host view and the status bar at the bottom of the window are updated during the restart progress.

Refer to the Admin API topics in the Developer Guide.

Creating a Container

This functionality is only available with the Command Line Interface.

To create a container:

Command:

gs.{sh/bat} container create <container ID>

Description:

This command creates the specified container.

Input Example:

<GS_HOME>/bin/gs container create admin~11100
<GS_HOME>/bin/gs.sh container create admin~11100

Parameters and Options:

Item Name Description
Parameter container ID ID of the container to be created.
Option count Number of containers to be created.