diff --git a/docs/source/guides/admin-guides/references/man1/lsdocker.1.rst b/docs/source/guides/admin-guides/references/man1/lsdocker.1.rst new file mode 100644 index 000000000..5f2807d8a --- /dev/null +++ b/docs/source/guides/admin-guides/references/man1/lsdocker.1.rst @@ -0,0 +1,92 @@ + +########## +lsdocker.1 +########## + +.. highlight:: perl + + +**** +NAME +**** + + +\ **lsdocker**\ - List docker instance. + + +******** +SYNOPSIS +******** + + +\ **lsdocker**\ \ *noderange*\ [\ **-l**\ |\ **--logs**\ ] + +\ **lsdocker**\ \ *dockerhost*\ + +\ **lsdocker**\ [\ **-h**\ |\ **--help**\ ] + +\ **lsdocker**\ {\ **-v**\ |\ **--version**\ } + + +*********** +DESCRIPTION +*********** + + +\ **lsdocker**\ To list docker instance info or all the running docker instance info if dockerhost is specified. + + +******* +OPTIONS +******* + + + +\ **-l|--logs**\ + + + +To return the logs of docker instance. Only works for docker instance. + + +******** +EXAMPLES +******** + + + +\* + + To get info for docker instance "host01c01" + + + .. code-block:: perl + + lsdocker host01c01 + host01c01: 50800dfd8b5f ubuntu /bin/bash 2016-01-13T06:32:59 running /host01c01 + + + + +\* + + To get info for running docker instance on dockerhost "host01" + + + .. code-block:: perl + + lsdocker host01 + host01: 50800dfd8b5f ubuntu /bin/bash 2016-1-13 - 1:32:59 Up 12 minutes /host01c01 + host01: 875ce11d5987 ubuntu /bin/bash 2016-1-21 - 1:12:37 Up 5 seconds /host01c02 + + + + + +******** +SEE ALSO +******** + + +mkdocker(1)|mkdocker.1, rmdocker(1)|rmdocker.1 + diff --git a/docs/source/guides/admin-guides/references/man1/mkdocker.1.rst b/docs/source/guides/admin-guides/references/man1/mkdocker.1.rst new file mode 100644 index 000000000..f37d1a88b --- /dev/null +++ b/docs/source/guides/admin-guides/references/man1/mkdocker.1.rst @@ -0,0 +1,164 @@ + +########## +mkdocker.1 +########## + +.. highlight:: perl + + +**** +NAME +**** + + +\ **mkdocker**\ - Create docker instance. + + +******** +SYNOPSIS +******** + + +\ **mkdocker**\ \ *noderange*\ [\ **image**\ =\ **image_name**\ [\ **command**\ =\ **command**\ ]] [\ **dockerflag**\ =\ **flags_to_create_instance**\ ] + +\ **mkdocker**\ [\ **-h**\ |\ **--help**\ ] + +\ **mkdocker**\ {\ **-v**\ |\ **--version**\ } + + +*********** +DESCRIPTION +*********** + + +\ **rmdocker**\ To create docker instances with the specified image, command and/or dockerflags. + + +******* +OPTIONS +******* + + + +\ **image**\ + + The docker image name that the instance will use. + + + +\ **command**\ + + The command that the instance will run based on the \ **image**\ specified. The \ **image**\ option must be specified in order to use this option. + + + +\ **dockerflag**\ + + A JSON string which will be used as parameters to create a docker. Please reference https://docs.docker.com/engine/reference/api/docker_remote_api_v1.21/ for more information about which parameters can be specified. + + Some useful flags are: + + + \ **AttachStdin**\ =\ **true**\ |\ **false**\ + + Whether attaches to stdin. + + + + \ **AttachStdout**\ =\ **true**\ |\ **false**\ + + Whether attaches to stdout. + + + + \ **AttachStderr**\ =\ **true**\ |\ **false**\ + + Whether attaches to stderr. + + + + \ **OpenStdin**\ =\ **true**\ |\ **false**\ + + Whether opens stdin. + + + + \ **Tty**\ =\ **true**\ |\ **false**\ + + Attach standard streams to a tty, including stdin if it is not closed. + + + + \ **NetworkDisabled**\ =\ **true**\ + + Disables networking for the docker instances, it can be used when specify static IP address for an instance after started. + + + + \ **ExposedPorts**\ + + An object mapping ports to an empty object in the form of: + + + .. code-block:: perl + + "ExposedPorts": { "/\: {}" } + + + + + \ **HostConfig: {"Binds"}**\ + + A list of volume bindings for this docker instance, the form will be: + + + .. code-block:: perl + + "HostConfig": {"Binds":[":"]} + + + + + + + +******** +EXAMPLES +******** + + +1. To create a basic docker instance with stdin opened + + +.. code-block:: perl + + mkdocker host01c01 image=ubuntu command=/bin/bash dockerflag="{\"AttachStdin\":true,\"AttachStdout\":true,\"AttachStderr\":true,\"OpenStdin\":true}" + host01c01: success + + +2. To create a docker instance with network disabled + + +.. code-block:: perl + + mkdocker host01c01 image=ubuntu command=/bin/bash dockerflag="{\"AttachStdin\":true,\"AttachStdout\":true,\"AttachStderr\":true,\"OpenStdin\":true,\"NetworkDisabled\":ture}" + host01c01: success + + +3. To create a docker instance which have dir "destdir" in docker instance bind from "srcdir" on dockerhost, and have "Tty" opened with which the docker instance can be attached after started to check the files under "destdir". + + +.. code-block:: perl + + mkdocker host01c01 image=ubuntu command=/bin/bash dockerflag="{\"AttachStdin\":true,\"AttachStdout\":true,\"AttachStderr\":true,\"OpenStdin\":true,\"Tty\":true,\"HostConfig\":{\"Binds\":[\"/srcdir:/destdir\"]}}" + host01c01: success + + + +******** +SEE ALSO +******** + + +rmdocker(1)|rmdocker.1, lsdocker(1)|lsdocker.1 + diff --git a/docs/source/guides/admin-guides/references/man1/rmdocker.1.rst b/docs/source/guides/admin-guides/references/man1/rmdocker.1.rst new file mode 100644 index 000000000..7583bc42e --- /dev/null +++ b/docs/source/guides/admin-guides/references/man1/rmdocker.1.rst @@ -0,0 +1,48 @@ + +########## +rmdocker.1 +########## + +.. highlight:: perl + + +******** +SYNOPSIS +******** + + +\ **rmdocker**\ \ *noderange*\ + +\ **rmdocker**\ [\ **-h**\ |\ **--help**\ ] + +\ **rmdocker**\ {\ **-v**\ |\ **--version**\ } + + +*********** +DESCRIPTION +*********** + + +\ **rmdocker**\ To remove docker instances with the specified node name. + + +******** +EXAMPLES +******** + + + +.. code-block:: perl + + rmdocker host01c01 + host01c01: success + + + +******** +SEE ALSO +******** + + +mkdocker(1)|mkdocker.1, lsdocker(1)|lsdocker.1 + diff --git a/docs/source/guides/admin-guides/references/man1/rpower.1.rst b/docs/source/guides/admin-guides/references/man1/rpower.1.rst index 29f6d19da..951726ccb 100644 --- a/docs/source/guides/admin-guides/references/man1/rpower.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rpower.1.rst @@ -95,6 +95,13 @@ zVM specific: \ **rpower**\ \ *noderange*\ [\ **on**\ |\ **off**\ |\ **reset**\ |\ **stat**\ |\ **softoff**\ ] +docker specific: +================ + + +\ **rpower**\ \ *noderange*\ [\ **start**\ |\ **stop**\ |\ **restart**\ |\ **pause**\ |\ **unpause**\ |\ **state**\ ] + + *********** DESCRIPTION @@ -305,6 +312,42 @@ OPTIONS +\ **start**\ + + To start a created docker instance. + + + +\ **stop**\ + + To stop a created docker instance. + + + +\ **restart**\ + + To restart a created docker instance. + + + +\ **pause**\ + + To pause all processes in the instance. + + + +\ **unpause**\ + + To unpause all processes in the instance. + + + +\ **state**\ + + To get state of the instance. + + + \ **-h**\ |\ **--help**\ Prints out a brief usage message. diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index e3ff511ca..9bfd043a9 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -46,6 +46,8 @@ my %usage = ( rpower noderange [on|off|reset|stat|softoff] MIC specific: rpower noderange [stat|state|on|off|reset|boot] + docker specific: + rpower noderange [start|stop|restart|pause|unpause|state] ", "rbeacon" => "Usage: rbeacon [on|off|stat] [-V|--verbose] @@ -288,6 +290,13 @@ my %usage = ( rmvm [-p] [-f] PPC (using Direct FSP Management) specific: rmvm ", + "mkdocker" => +"Usage: mkdocker [image= [command=]] [dockerflag=]", + "lsdocker" => +"Usage: lsdocker + lsdocker [-l|--logs]", + "rmdocker" => +"Usage: rmdocker ", "lsslp" => "Usage: lsslp [-h|--help|-v|--version] lsslp [][-V|--verbose][-i ip[,ip..]][-w][-r|-x|-z][-n][-I][-s FRAME|CEC|MM|IVM|RSA|HMC|CMM|IMM2|FSP] diff --git a/xCAT-client/pods/man1/lsdocker.1.pod b/xCAT-client/pods/man1/lsdocker.1.pod new file mode 100644 index 000000000..700a73df9 --- /dev/null +++ b/xCAT-client/pods/man1/lsdocker.1.pod @@ -0,0 +1,53 @@ +=head1 NAME + +B - List docker instance. + +=head1 SYNOPSIS + +B I [B<-l>|B<--logs>] + +B I + +B [B<-h>|B<--help>] + +B {B<-v>|B<--version>} + + +=head1 DESCRIPTION + +B To list docker instance info or all the running docker instance info if dockerhost is specified. + +=head1 OPTIONS + +=over 3 + +=item B<-l|--logs> + +=back + +To return the logs of docker instance. Only works for docker instance. + +=head1 EXAMPLES + +=over 3 + +=item * + +To get info for docker instance "host01c01" + + lsdocker host01c01 + host01c01: 50800dfd8b5f ubuntu /bin/bash 2016-01-13T06:32:59 running /host01c01 + +=item * + +To get info for running docker instance on dockerhost "host01" + + lsdocker host01 + host01: 50800dfd8b5f ubuntu /bin/bash 2016-1-13 - 1:32:59 Up 12 minutes /host01c01 + host01: 875ce11d5987 ubuntu /bin/bash 2016-1-21 - 1:12:37 Up 5 seconds /host01c02 + +=back + +=head1 SEE ALSO + +L, L diff --git a/xCAT-client/pods/man1/mkdocker.1.pod b/xCAT-client/pods/man1/mkdocker.1.pod new file mode 100644 index 000000000..4720b792f --- /dev/null +++ b/xCAT-client/pods/man1/mkdocker.1.pod @@ -0,0 +1,97 @@ +=head1 NAME + +B - Create docker instance. + +=head1 SYNOPSIS + +B I [B=B [B=B]] [B=B] + +B [B<-h>|B<--help>] + +B {B<-v>|B<--version>} + + +=head1 DESCRIPTION + +B To create docker instances with the specified image, command and/or dockerflags. + +=head1 OPTIONS + +=over 3 + +=item B + +The docker image name that the instance will use. + +=item B + +The command that the instance will run based on the B specified. The B option must be specified in order to use this option. + +=item B + +A JSON string which will be used as parameters to create a docker. Please reference https://docs.docker.com/engine/reference/api/docker_remote_api_v1.21/ for more information about which parameters can be specified. + +Some useful flags are: + +=over 3 + +=item B=B|B + +Whether attaches to stdin. + +=item B=B|B + +Whether attaches to stdout. + +=item B=B|B + +Whether attaches to stderr. + +=item B=B|B + +Whether opens stdin. + +=item B=B|B + +Attach standard streams to a tty, including stdin if it is not closed. + +=item B=B + +Disables networking for the docker instances, it can be used when specify static IP address for an instance after started. + +=item B + +An object mapping ports to an empty object in the form of: + + "ExposedPorts": { "/\: {}" } + +=item B + +A list of volume bindings for this docker instance, the form will be: + + "HostConfig": {"Binds":[":"]} + +=back + +=back + +=head1 EXAMPLES + +1. To create a basic docker instance with stdin opened + + mkdocker host01c01 image=ubuntu command=/bin/bash dockerflag="{\"AttachStdin\":true,\"AttachStdout\":true,\"AttachStderr\":true,\"OpenStdin\":true}" + host01c01: success + +2. To create a docker instance with network disabled + + mkdocker host01c01 image=ubuntu command=/bin/bash dockerflag="{\"AttachStdin\":true,\"AttachStdout\":true,\"AttachStderr\":true,\"OpenStdin\":true,\"NetworkDisabled\":ture}" + host01c01: success + +3. To create a docker instance which have dir "destdir" in docker instance bind from "srcdir" on dockerhost, and have "Tty" opened with which the docker instance can be attached after started to check the files under "destdir". + + mkdocker host01c01 image=ubuntu command=/bin/bash dockerflag="{\"AttachStdin\":true,\"AttachStdout\":true,\"AttachStderr\":true,\"OpenStdin\":true,\"Tty\":true,\"HostConfig\":{\"Binds\":[\"/srcdir:/destdir\"]}}" + host01c01: success + +=head1 SEE ALSO + +L, L diff --git a/xCAT-client/pods/man1/rmdocker.1.pod b/xCAT-client/pods/man1/rmdocker.1.pod new file mode 100644 index 000000000..6461aafec --- /dev/null +++ b/xCAT-client/pods/man1/rmdocker.1.pod @@ -0,0 +1,26 @@ + +=head1 NAME + +B - Remove docker instance. + +=head1 SYNOPSIS + +B I + +B [B<-h>|B<--help>] + +B {B<-v>|B<--version>} + + +=head1 DESCRIPTION + +B To remove docker instances with the specified node name. + +=head1 EXAMPLES + + rmdocker host01c01 + host01c01: success + +=head1 SEE ALSO + +L, L diff --git a/xCAT-client/pods/man1/rpower.1.pod b/xCAT-client/pods/man1/rpower.1.pod index f4606a599..825c2f859 100644 --- a/xCAT-client/pods/man1/rpower.1.pod +++ b/xCAT-client/pods/man1/rpower.1.pod @@ -50,6 +50,10 @@ B I [B|B] B I [B|B|B|B|B] +=head2 docker specific: + +B I [B|B|B|B|B|B] + =head1 DESCRIPTION B controls the power for a single or range of nodes, via the out-of-band path. @@ -199,6 +203,30 @@ To specify that the target node will be power down if B action failed. To specify that the target node will be reset if B action failed. +=item B + +To start a created docker instance. + +=item B + +To stop a created docker instance. + +=item B + +To restart a created docker instance. + +=item B + +To pause all processes in the instance. + +=item B + +To unpause all processes in the instance. + +=item B + +To get state of the instance. + =item B<-h>|B<--help> Prints out a brief usage message. diff --git a/xCAT-server/lib/xcat/plugins/AAAusage.pm b/xCAT-server/lib/xcat/plugins/AAAusage.pm index a6d638ce1..d6d8a94d4 100644 --- a/xCAT-server/lib/xcat/plugins/AAAusage.pm +++ b/xCAT-server/lib/xcat/plugins/AAAusage.pm @@ -27,6 +27,9 @@ sub handled_commands { lsvm => 'AAAusage', chvm => 'AAAusage', rmvm => 'AAAusage', + mkdocker => 'AAAusage', + lsdocker => 'AAAusage', + rmdocker => 'AAAusage', #lsslp => 'AAAusage', rflash => 'AAAusage', mkhwconn => 'AAAusage',