In this article, you will be introduced to the steps for creating different types of containers. For more information on what Containers are, and what types of Containers are possible, check this article.

Prerequisites 

  1. In case of an Image based Container, if the Docker Image is available on a private Registry, then the Registry needs to be registered with gopaddle prior to creating a Container. Check the article Adding a Docker Registry for the steps on how to add a registry to gopaddle.
  2. Configuration Files (if any) to be mounted inside the container at the time of deployment. These configuration files can be added as a File type Configuration Resource as suggested here.
  3. A Collection of Environment Variables  (if any) that can be re-used within the container at the time of deployment. These Environment variables can be added as a collection of Key/Value pairs in a Configuration Resource as suggested here.

Steps to create a container

  1. To create a container, choose the Containers option from the left panel and then select New Container. This opens up a container set up wizard. 
  2. Choose the Artifact Source. If the Artifact Source is Source Control or Docker Project, you will be asked to add a build script once the Container resource is created.

If the Artifact Source is Docker Image, then choose the Registry and the Docker image name along with the image tag

3. To create an Init container, click on Advanced option and choose the Container Type. If no Container type is chosen, then the Default type will be assumed.

4. Add the network ports and the routing paths. In the Network Ports input box, mention the network port and press tab or press enter to add the network port. Once the network ports are added, add the routes paths by selecting the protocol, port and the path for each route path and click Add. In case of headless containers, the Network port and thus the Route Paths are not required.

At least one Network port is required if a HTTP based health check needs to be added in the next step.

4. Add Healthcheck attributes. Healthchecks are readiness probes that are called or executed to check if the containers are ready to accept requests. If a Container Healthcheck fails, then the container is restarted repeatedly until the Healthcheck succeeds.
Healthchecks can be performed over a HTTP end point within the container or by executing a script.

In case of HTTP based Healthcheck, choose one of the network ports and provide the path that serves the Healthcheck requests. The Healthcheck end point within the container must return a HTTP 200 OK status code. 

In case of script based Healthcheck, enter the commands line by line as below. Here is an example of a script based Healthcheck for a postgresql server :

5. Add the data folder which can be used for mounting volumes

6. Add the configuration files along with the mount path and mode. If the Encrypt mode is chosen as Encrypt, then the file content is encrypted in base-64 while storing on disk. In Kubernetes, the configuration files will be mounted as Secrets.

7. Add any environment variables to be made available to the container. You can either add new key/value pairs or use a pre-configured collection of Environment variables. To add new set of Key/Value pairs, select the type as New Key/Value Pair, add a  Key and a Value and select Add

You can also choose an existing Environment Variables collection by choosing the type as Existing.

Select the Literal Configuration and its version and choose Add.
Once the literals are added to the list, you can encrypt the key/value pairs in base-64 format by selecting the Environment Variables and clicking Encrypt. In Kubernetes, the environment variables will be stored as Secrets.

8. Add the container dependencies like the service name and the service port. Read more about Services here. gopaddle does a soft check and warns you when a dependency is missing at the time of deployment. gopaddle also schedules the deployment of these containers and services based on the order of dependencies.

Did this answer your question?