diff --git a/docs/source/advanced/docker/lifecycle_management.rst b/docs/source/advanced/docker/lifecycle_management.rst index 8318f2e38..cd3385d20 100644 --- a/docs/source/advanced/docker/lifecycle_management.rst +++ b/docs/source/advanced/docker/lifecycle_management.rst @@ -5,7 +5,7 @@ The Docker linux container technology is currently very popular. xCAT can help m This document describes how to use xCAT for docker management, from Docker Host setup to docker container operationis. -**Note:** The document is based on **Docker Version 1.9.1** and **Docker API version 1.21.** And the Docker Host is based on **ubuntu14.04.3 x86_64**. At the time of this writing (February 2016), docker host images are not available for **ppc64** architecture from docker.org. You can search online to find them or build your own. +**Note:** The document is based on **Docker Version 1.10.x** and **Docker API version 1.22.** And the Docker Host is based on **ubuntu14.04.3 x86_64**. At the time of this writing (February 2016), docker host images are not available for **ppc64** architecture from docker.org. You can search online to find them or build your own. Setting up Docker Host ---------------------- @@ -15,7 +15,6 @@ The **Docker Host** is the bare metal server or virtual machine where Docker con The *dockerhost* at a minimum must provide the following: * An Operating System for running docker daemon -* A Bridge, which can be used by Docker Container to create virtual network adapter on * The certification related files to be used by Docker service for trusted connection. Preparing osimage for docker host @@ -57,7 +56,7 @@ The osimage for dockerhost will be like this: :: osarch=x86_64 osname=Linux osvers=ubuntu14.04.3 - otherpkgdir=https://apt.dockerproject.org/repo ubuntu-trusty main + otherpkgdir=https://apt.dockerproject.org/repo ubuntu-trusty main,http://cz.archive.ubuntu.com/ubuntu trusty main otherpkglist=/install/custom/ubuntu1404/ubuntu1404_docker.pkglist pkgdir=/install/ubuntu14.04.3/x86_64 pkglist=/install/custom/ubuntu1404/ubuntu1404.pkglist @@ -65,43 +64,25 @@ The osimage for dockerhost will be like this: :: provmethod=install template=/opt/xcat/share/xcat/install/ubuntu/compute.tmpl -Preparing config bridge for dockerhost -`````````````````````````````````````` -Currently, the script *xHRM* can be used to config bridge based on a network adapter. In can be replaced by *confignetworks* in the future. To have the dockerhost configure bridge during OS provisioning, use the command: :: +Preparing setup trust connection for docker service and create docker network object +```````````````````````````````````````````````````````````````````````````````````` +Currently, a customer defined network object is needed when create a docker container with static IP address, it can be done with the command: :: - chdef host01 -p postbootscripts="xHRM bridgeprereq eth0:mydocker0" + chdef host01 -p postbootscripts="setupdockerhost =/@[:nicname]" -The above command configures bridge *mydocker0* based on *eth0*. If needed, replace *eth0* with the network interface to be used for the docker bridge. **Don't modify bridge name "mydocker0"** since it will be used when setting up docker service on dockerhost. +* netobj_name: the network object to be created, it will be used in *dockernics* when creating docker container +* subnet/netmask@gateway: the network which the IP address of docker container running on the docker host must be located in. If *nicname* is specified, the *subnet/netmask* must be the subnet of the nic *nicname* located in. And *gateway* shall be the IP address of the nic *nicname*. +* nicname: the physical nic name which will be attached to the network object -Preparing setup trust connection for docker service -``````````````````````````````````````````````````` +For example, a network object *mynet0* with subnet *10.0.0.0/16* and gateway *10.0.101.1* on nic *eth0* can be created with the command: :: -:: - - chdef host01 -p postbootscripts="setupdockerhost" + chdef host01 -p postbootscripts="setupdockerhost mynet0=10.0.0.0/16@10.0.101.1:eth0" Start OS provisioning for dockerhost ```````````````````````````````````` Reference :ref:`Initialize the Compute for Deployment` for how to finish an OS deployment. -Setup docker instance network configuration tool on dockerhost(Optional) -```````````````````````````````````````````````````````````````````````` - -Currently, Docker doesn't provide native support for configuring specified ip address for a docker instance runing on the dockerhost. The `pipework `_ package can help. After dockerhost is up and running, do the following: - -First, download the "pipework" :: - - git clone https://github.com/jpetazzo/pipework.git - -Then copy the script "pipework" to "/usr/bin/pipework" :: - - cp ./pipework/pipework /usr/bin/pipework - -The *pipework* is depended on "arping", so the package "iputils-arping" needed to be installed :: - - apt-get install iputils-arping - Docker instance management -------------------------- @@ -110,14 +91,18 @@ After the dockerhost is ready, a docker instance can be managed through xCAT com # lsdef host01c01 Object name: host01c01 dockerhost=host01:2375 + dockernics=mynet0 groups=docker,all - ip= + ip=10.0.120.1 + mac=02:42:0a:00:78:01 mgt=docker postbootscripts=otherpkgs postscripts=syslog,remoteshell,syncfiles The command :doc:`mkdef ` or :doc:`chdef ` can be used to create a new docker instance node or change the node attributes. Specify any available unused ip address for *ip* attribute. +After docker instance node is defined, use command `makehosts host01c01` to add node *host01c01* and its IP address *10.0.120.1* into /etc/hosts. + Create docker instance `````````````````````` :: @@ -127,14 +112,12 @@ Create docker instance * node - The node object which represents the docker instance * image - The image name that the docker instance will use * command - The command that the docker will run -* dockerflag - A JSON string which will be used as parameters to create a docker. Reference `docker API v1.21 `_ for more information about which parameters can be specified for "dockerflag". +* dockerflag - A JSON string which will be used as parameters to create a docker. Reference `docker API v1.22 `_ for more information about which parameters can be specified for "dockerflag". To create the docker instance *host01c01* with image *ubuntu* and command */bin/bash*, use: :: mkdocker host01c01 image=ubuntu command=/bin/bash dockerflag="{\"AttachStdin\":true,\"AttachStdout\":true,\"AttachStderr\":true,\"OpenStdin\":true}" -**Note**: The *mkdocker* can not pull image automatically if the specified image does not exist on dockerhost. Pull the image manually with **docker pull ** in dockerhost before running **mkdocker**. Check available images with **docker images** - Remove docker instance `````````````````````` :: @@ -190,28 +173,3 @@ Check docker instance status :: rpower state - -Configure docker instance IP address(Optional) -`````````````````````````````````````````````` - -Currently, the IP address specified in *ip* attribute of the docker instance node definition can not be configured to the docker instance automatically. To configure it, the following steps are needed: - -* Create docker instance with network disabled - -:: - - mkdocker host01c01 image=ubuntu command=/bin/bash dockerflag="{\"AttachStdin\":true,\"AttachStdout\":true,\"AttachStderr\":true,\"OpenStdin\":true,\"NetworkDisabled\":true}" - -* Start docker instance - -:: - - rpower host01c01 start - -* Configure ip for docker instance - - Reference section "Setup docker instance network configuration tool on dockerhost" above to setup "pipework" on dockerhost before running the following command: - -:: - - pipework mydocker0 host01c01 /@ diff --git a/docs/source/guides/admin-guides/references/man1/mkdocker.1.rst b/docs/source/guides/admin-guides/references/man1/mkdocker.1.rst index 3b781ac7f..451948976 100644 --- a/docs/source/guides/admin-guides/references/man1/mkdocker.1.rst +++ b/docs/source/guides/admin-guides/references/man1/mkdocker.1.rst @@ -54,7 +54,7 @@ OPTIONS \ **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. + 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.22/ for more information about which parameters can be specified. Some useful flags are: @@ -89,12 +89,6 @@ OPTIONS - \ **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: @@ -140,26 +134,14 @@ Output is similar to: .. code-block:: perl + host01c01: Pull image ubuntu start + host01c01: Pull image ubuntu done + host01c01: Remove default network connection + host01c01: Connecting customzied network 'mynet0' 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}" - - -Output is similar to: - - -.. code-block:: perl - - 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". +2. 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 @@ -172,6 +154,8 @@ Output is similar to: .. code-block:: perl + host01c01: Remove default network connection + host01c01: Connecting customzied network 'mynet0' host01c01: success diff --git a/docs/source/guides/admin-guides/references/man1/rmdocker.1.rst b/docs/source/guides/admin-guides/references/man1/rmdocker.1.rst index 82d3a7918..33db44ce4 100644 --- a/docs/source/guides/admin-guides/references/man1/rmdocker.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rmdocker.1.rst @@ -11,7 +11,7 @@ SYNOPSIS ******** -\ **rmdocker**\ \ *noderange*\ +\ **rmdocker**\ \ *noderange*\ [\ **-f | -**\ **-force**\ ] \ **rmdocker**\ [\ **-h | -**\ **-help**\ ] @@ -23,7 +23,20 @@ DESCRIPTION *********** -\ **rmdocker**\ To remove docker instances with the specified node name. +\ **rmdocker**\ To remove docker instances with the specified node name + + +******* +OPTIONS +******* + + + +\ **-f|-**\ **-force**\ + + + +Force to removal of a running container or failed to disconnect customized network ******** @@ -35,6 +48,7 @@ EXAMPLES .. code-block:: perl rmdocker host01c01 + host01c01: Disconnect customzied network 'mynet0' done host01c01: success diff --git a/xCAT-client/pods/man1/mkdocker.1.pod b/xCAT-client/pods/man1/mkdocker.1.pod index 850f75695..95479f404 100644 --- a/xCAT-client/pods/man1/mkdocker.1.pod +++ b/xCAT-client/pods/man1/mkdocker.1.pod @@ -29,7 +29,7 @@ The command that the instance will run based on the B specified. The 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. +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.22/ for more information about which parameters can be specified. Some useful flags are: @@ -55,10 +55,6 @@ Whether opens stdin. 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: @@ -83,22 +79,20 @@ A list of volume bindings for this docker instance, the form will be: Output is similar to: + host01c01: Pull image ubuntu start + host01c01: Pull image ubuntu done + host01c01: Remove default network connection + host01c01: Connecting customzied network 'mynet0' 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}" - -Output is similar to: - - 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". +2. 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\"]}}" Output is similar to: + host01c01: Remove default network connection + host01c01: Connecting customzied network 'mynet0' host01c01: success =head1 SEE ALSO diff --git a/xCAT-client/pods/man1/rmdocker.1.pod b/xCAT-client/pods/man1/rmdocker.1.pod index 6461aafec..efe339027 100644 --- a/xCAT-client/pods/man1/rmdocker.1.pod +++ b/xCAT-client/pods/man1/rmdocker.1.pod @@ -5,7 +5,7 @@ B - Remove docker instance. =head1 SYNOPSIS -B I +B I [B<-f>|B<--force>] B [B<-h>|B<--help>] @@ -14,11 +14,22 @@ B {B<-v>|B<--version>} =head1 DESCRIPTION -B To remove docker instances with the specified node name. +B To remove docker instances with the specified node name + +=head1 OPTIONS + +=over 3 + +=item B<-f|--force> + +=back + +Force to removal of a running container or failed to disconnect customized network =head1 EXAMPLES rmdocker host01c01 + host01c01: Disconnect customzied network 'mynet0' done host01c01: success =head1 SEE ALSO