diff --git a/docs/user_doc/SUMMARY.md b/docs/user_doc/SUMMARY.md index 81ab21eeaf..a5090b4547 100644 --- a/docs/user_doc/SUMMARY.md +++ b/docs/user_doc/SUMMARY.md @@ -33,7 +33,8 @@ * [VCH Deployment Options](vic_vsphere_admin/vch_installer_options.md) * [Set Environment Variables](vic_vsphere_admin/vic_env_variables.md) * [Advanced Examples of Deploying a VCH](vic_vsphere_admin/vch_installer_examples.md) - * [Deploy a VCH for Use with vSphere Integrated Containers Registry](vic_vsphere_admin/deploy_vch_registry.md) + * [VCH for Use with Registry](vic_vsphere_admin/deploy_vch_registry.md) + * [VCH for Use with `dch-photon`](vic_vsphere_admin/deploy_vch_dchphoton.md) * [Use Different User Accounts for VCH Deployment and Operation](vic_vsphere_admin/set_up_ops_user.md) * [VCH Administration](vic_vsphere_admin/vch_admin.md) * [Interoperability](vic_vsphere_admin/interop.md) diff --git a/docs/user_doc/vic_app_dev/build_push_images.md b/docs/user_doc/vic_app_dev/build_push_images.md index 5c0aa6442e..0f7de2e1e4 100644 --- a/docs/user_doc/vic_app_dev/build_push_images.md +++ b/docs/user_doc/vic_app_dev/build_push_images.md @@ -1,30 +1,117 @@ -# Building and Pushing Images with vSphere Integrated Containers +# Using `dch-photon` to Build and Push Images The current version of vSphere Integrated Containers Engine does not support `docker build` or `docker push`. As a consequence, the workflow for developing container images and pushing them to a registry server is slightly different to the workflow in a regular Docker environment. -- You use standard Docker to build, tag, and push a container image to a registry. +- You use standard Docker to build, tag, and push a container image to a registry. - You pull the image from the registry to a vSphere Integrated Containers virtual container host (VCH) to use it. -This topic provides an example of pushing and pulling an image to and from vSphere Integrated Containers Registry. You can use a different private registry server. For simplicity, the example uses the `busybox` container image instead of building a new image. +This release of vSphere Integrated Containers includes an image repository named `dch-photon`, that is pre-loaded in the `default-project` in vSphere Integrated Containers Registry. The `dch-photon` image allows you to deploy a standard Docker container host that runs in a Photon OS container. You can then use this Docker container host to perform `docker build` and `docker push` operations without having to install a local Docker host on your working machine. **Prerequisites** -- You have access to an image repository. For example, a project repository must exist in vSphere Integrated Containers Registry and you must have a user account that can access that project repository. -- Configure your Docker client to use the vSphere Integrated Containers Registry certificate. For information about how to pass the registry certificate to the Docker client, see [Using vSphere Integrated Containers Registry](configure_docker_client.md#registry) in Configure the Docker Client for Use with vSphere Integrated Containers. -- You have access to a VCH that the vSphere administrator configured so that it can connect to the registry. For information about how deploy a VCH so that it can access a private registry, see the [Private Registry Options](../vic_vsphere_admin/vch_installer_options.md#registry) section of VCH Deployment Options and [Deploy a VCH for Use with vSphere Integrated Containers Registry](../vic_vsphere_admin/deploy_vch_registry.md) in *Install, Deploy, and Maintain the vSphere Integrated Containers Infrastructure* -- In the example, connections to the registry are secured by TLS, but for simplicity the connection between the Docker client and the VCH is not. As a consequence, the Docker commands to run in the VCH do not include any TLS options. If your VCH uses TLS authentication, adapt the Docker commands accordingly, and use port 2376 instead of 2375 when connecting to the VCH. For information about how to connect a Docker client to a VCH that uses TLS authentication, see [Connecting to the VCH](configure_docker_client.md#connectvch) in Configure the Docker Client for Use with vSphere Integrated Containers. + +- Configure your Docker client to use the vSphere Integrated Containers Registry certificate. For information about how to obtain the registry certificate and pass it to the Docker client, see [Using vSphere Integrated Containers Registry](configure_docker_client.md#registry) in Configure the Docker Client for Use with vSphere Integrated Containers. +- You have access to a VCH that the vSphere administrator configured so that it can connect to the registry to pull the `dch-photon` image, and so that it has a default volume store. For information about how deploy a VCH for use with `dch-photon`, see the [Deploy a Virtual Container Host for Use with `dch-photon`](../vic_vsphere_admin/deploy_vch_dchphoton.md) in *Install, Deploy, and Maintain the vSphere Integrated Containers Infrastructure*. +- This topic provides an example of using `dch-photon` to push an image to vSphere Integrated Containers Registry and then pull it into a VCH. For simplicity, the example uses a VCH that was deployed with the `--no-tlsverify` option. If your VCH implements TLS verification of clients, you must import the VCH certificates into your Docker client and adapt the Docker commands accordingly. For information about how to connect a Docker client to a VCH that uses full TLS authentication, see [Connecting to the VCH](configure_docker_client.md#connectvch) in Configure the Docker Client for Use with vSphere Integrated Containers. **Procedure** -1. Pull the `busybox` container image from Docker Hub.
docker pull busybox
In a real-world scenario you would build a new container image rather than pulling the `busybox` image. -2. Tag the image for uploading to the appropriate project repository in vSphere Integrated Containers Registry.
docker tag busybox:1.26 registry_address/project_name/busybox:1.26 
If vSphere Integrated Containers Registry listens for connections on a non-default port, include the port number in the registry address. -3. Log in to vSphere Integrated Containers Registry.
docker login registry_address
-3. Push the image from the standard Docker host to vSphere Integrated Containers Registry.
docker push registry_address/project_name/busybox:1.26 
-5. Pull the image from vSphere Integrated Containers Registry into the VCH.
docker -H vch_address:2375 pull registry_address/project_name/busybox:1.26 
-6. List the images that are running in your VCH.
docker -H vch_address:2375 images
+1. Log in to vSphere Integrated Containers Registry from the VCH. + +
docker -H vch_address:2376 --tls login registry_address
+2. Pull the `dch-photon` image from vSphere Integrated Containers Registry into your VCH. + +
docker -H vch_address:2376 --tls pull registry_address/default-project/dch-photon:1.13
+ +3. Run a `dch-photon` container from the image. + +
docker -H vch_address:2376 --tls run --name dch-photon -d -p 12376:2376 registry_address/default-project/dch-photon:1.13 -tlsverify
+ + This command uses the following Docker options to run the `dch-photon` container: + + - `-d`, to run the `dch-photon` container in the background. + - `-p` to map port 12376 on the VCH to the Docker TLS port 2376 on the `dch-photon` container + + This command also configures the Docker host that runs in the `dch-photon` container with the following option: + + + - `-tlsverify`: Verifies the client and server certificates for the connection from the Docker host running in the `dch-photon` container to the registry. + + +4. Run `docker ps` on the VCH to see the status of the running `dch-photon` container. + +
docker -H vch_address:2376 --tls ps
+ + In the output you see details of the port mapping from port 12376 on the VCH to port 2376/tcp on the `dch-photon` container. + +4. Run `docker info` on the mapped port 12376 to obtain information about the Docker host running in the `dch-photon` container. + + Note that this command specifies port 12376, because you are running the command in the Docker host in the `dch-photon` container. + +
docker -H vch_address:12376 --tls info
+ + In the output you see that this is a regular Docker 1.13.1 host. + +6. Create the folder structure for the registry certificate in the `dch-photon` container. + + The `dch-photon` container requires the CA certificate of the registry server. Note that these commands specify port 2376, because you are running them in the VCH. + + - First create a folder named `/etc/docker/certs.d`.
docker -H vch_address:2376 --tls exec dch-photon mkdir /etc/docker/certs.d
+ - Then create a subfolder with the same name as the registry address, to contain the certificate.
docker -H vch_address:2376 --tls exec dch-photon mkdir /etc/docker/certs.d/registry_address
+ +7. Copy the CA certificate of the vSphere Integrated Containers Registry into the certificates folder in the `dch-photon` container. + + Note that this command specifies port 2376. + +
docker -H vch_address:2376 --tls cp local_cert_path/ca.crt dch-photon:/etc/docker/certs.d/registry_address/ca.crt
+ +7. Restart the `dch-photon` container. + + Restarting the container allows the Docker host that is running inside it to load the certificate. + + Note that this command specifies port 2376. + +
docker -H vch_address:2376 --tls restart dch-photon
+ +5. Create a simple `Dockerfile` and save it in the current directory. + +
FROM debian:latest
+
+    RUN apt-get update -y && apt-get install -y fortune-mod fortunes
+
+    ENTRYPOINT ["/usr/games/fortune", "-s"]
+ +6. Build an image from the `Dockerfile` in the `dch-photon` Docker host, and tag it with the path to a project in vSphere Integrated Containers Registry. + + Note that this command specifies port 12376. + +
docker -H vch_address:12376 --tls build  -t registry_address/default-project/test-container .
+ +8. Log in to vSphere Integrated Containers Registry from the `dch-photon` Docker host. + + Note that this command specifies port 12376. + +
docker -H vch_address:12376 --tls login registry_address
+ +6. Push the image from the `dch-photon` Docker host to the registry. + + Note that this command specifies port 12376. + +
docker -H vch_address:12376 --tls push registry_address/default-project/test-container
+ +6. Pull the image from the registry into the VCH. + + Note that this command specifies port 2376. + +
 docker -H vch_address:2376 --tls pull registry_address/default-project/test-container
+ +6. Run a container from this image on the VCH. + +
 docker -H vch_address:2376 --tls run registry_address/default-project/test-container
+ +6. List the containers that are running in the VCH. + +
docker -H vch_address:2376 --tls ps
**Result** -The image that you pulled from vSphere Integrated Containers Registry appears in the list of images that are available in this VCH. -
-REPOSITORY                                    TAG          IMAGE ID            
-registry_address/project_name/busybox    1.26         7e156d496c9f
+The container that you ran from an image that you built and pushed to vSphere Integrated Containers Registry in `dch-photon` appears in the list of containers that are running in this VCH. diff --git a/docs/user_doc/vic_app_dev/configure_docker_client.md b/docs/user_doc/vic_app_dev/configure_docker_client.md index b810ec4cf0..5719f3adc1 100644 --- a/docs/user_doc/vic_app_dev/configure_docker_client.md +++ b/docs/user_doc/vic_app_dev/configure_docker_client.md @@ -74,7 +74,7 @@ This example configures a Linux Docker client so that you can log into vSphere I 2. Switch to `sudo` user.
$ sudo su
2. Create a subfolder in the Docker certificates folder, using the registry's IP address as the folder name.
$ mkdir -p /etc/docker/certs.d/registry_ip
3. Copy the registry's CA certificate into the folder.
$ cp ca.crt /etc/docker/certs.d/registry_ip/
-6. Open a new terminal and attempt to log in to the registry server, specifying the IP address of the registry server.
$ docker login registry_ip
+6. Open a new terminal and attempt to log in to the registry server, specifying the IP address of the registry server.
$ docker login registry_ip
7. If the login fails with a certificate error, restart the Docker daemon.
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker
### Docker on Windows ### diff --git a/docs/user_doc/vic_vsphere_admin/deploy_vch_dchphoton.md b/docs/user_doc/vic_vsphere_admin/deploy_vch_dchphoton.md new file mode 100644 index 0000000000..f99db980f8 --- /dev/null +++ b/docs/user_doc/vic_vsphere_admin/deploy_vch_dchphoton.md @@ -0,0 +1,41 @@ +# Deploy a Virtual Container Host for Use with `dch-photon` # + +This version of vSphere Integrated Containers includes an image repository named `dch-photon`, that is pre-loaded in the `default-project` in vSphere Integrated Containers Registry. + +The `dch-photon` image allows container developers to deploy a standard Docker container host that runs in a Photon OS container. Container developers can use this Docker engine to perform operations in standard Docker. For example, developers can use `dch-photon` containers to perform operations that virtual container hosts (VCHs) do not support in this version of vSphere Integrated Containers, such as `docker build` and `docker push`. + +For container developers to be able to deploy containers from the `dch-photon` image, you must deploy VCHs with a specific configuration. + +**Prerequisites** + +- You downloaded the vSphere Integrated Containers Engine bundle from http://vic_appliance_address. +- Obtain the vCenter Server or ESXi host certificate thumbprint. For information about how to obtain the certificate thumbprint, see [Obtain the Certificate Thumbprint of vCenter Server or an ESXi Host](obtain_thumbprint.md). + +**Procedure** + +1. Log in to the vSphere Integrated Containers Management Portal with a vSphere administrator, Cloud Admin or DevOps admin user account. + + vSphere administrator accounts for the Platform Services Controller with which vSphere Integrated Containers is registered are automatically granted Cloud Admin access. +2. Go to **Administration** > **Configuration**, and click the link to download the **Registry Root Cert**. +3. Use `vic-machine create` to deploy a VCH. + + - The VCH must be able to pull the `dch-photon` image from the vSphere Integrated Containers Registry instance. You must specify the registry's CA certificate by using the [`--registry-ca`](vch_installer_options.md#registry-ca) option. + - A `dch-photon` container creates an anonymous volume, and as such requires named `default`. + + For simplicity, this example deploys a VCH with the `--no-tls` flag, so that container application developers do not need to use a TLS certificate to connect a Docker client to the VCH. However, the connection between the VCH and the registry still requires certificate authentication.
vic-machine-operating_system create
+--target 'Administrator@vsphere.local':password@vcenter_server_address/dc1
+--compute-resource cluster1
+--image-store datastore1
+--bridge-network vch-bridge
+--name vch_dch_photon
+--thumbprint vcenter_server_certificate_thumbprint
+--no-tlsverify
+--registry-ca cert_path/ca.crt
+--volume-store datastore_name:default
+
+ + You could also specify --volume-store nfs://datastore_name/path_to_share_point:default to designate an NFS share point as the default volume store. + +**Result** + +The VCH that you deployed can access vSphere Integrated Containers Registry, and has a volume store named `default`. It is ready for container developers to use with `dch-photon` containers. \ No newline at end of file