Example of Provisioning a Single Container
This section illustrates how you can provision a PostgreSQL container using templates.
Prerequisities
Verify that you have perfomed the following steps:
- Deployed a virtual container host (VCH).
- Have a vCenter Server Single Sign-On user account with vSphere administrator privileges, or a user account that has been granted the Management Portal Administrator role in vSphere Integrated Containers.
- Created a project and assigned users to the project.
- Added the container host to the project.
Create a Volume
Create a volume called pgdata
.
- In the management portal, navigate to Deployments > Volumes and click +Volume.
- On the Create Volume page, select the Advanced check box to access all available settings.
Configure the following settings:
- Name. Enter
pgdata
as the volume name. - Hosts. Select the host from the list.
- Name. Enter
Click Create.
Create a Network
- In the management portal, navigate to Deployments > Networks and click +Network.
On the Create Network page, configure the following settings:
- Name. Enter
datanet
as the network name. - Hosts. Select the host from the list.
- Name. Enter
Click Create.
Create a Template
Create a template and add the postgres
container to it.
- In the management portal, navigate to Library > Templates and click +Template.
- On the Create a Template page, enter the container name, for example,
Postgres-container
and click Proceed. - In the Edit Template page, click Add Container.
- In the Add Container Definition page, select the
library/postgres
container and click Continue.
Configure the Template
In the Edit Container Defintion page, configure the basic details: 1. Image. The image that you want to instantiate the container from. This displays
registry.hub.docker.com/library/postgres
. Select the version. For example,9.6
. 2. Name. Displays the name that you entered,Postgres-container
.On the Network tab, configure the following: 1. Select Publish All Ports. 2. In the list under Networks, select Add Network. 3. Select the Existing checkbox and click in the search field under Name to see a list of added networks. Select
datanet
from the listOn the Storage tab, in Volumes, enter
pgdata
as Host and/var/lib/postgresql/data
as Container.On the Policy tab, configure the following: 1. Select
Always
under Restart Policy. 2. Enter2
for CPU Shares. 3. Enter4 GB
for Memory Limit.On the Environment tab, configure Environment Variables. Enter
POSTGRES_PASSWORD
in Name and the password in Value.- Click Add to add the container.
Provision the Template
Once you configure the template, the container and the network and volume that you have configured appear in the Edit Template page.
Click the icon on the right hand top corner of the page to provision Postgres-container
.