Creating a Docker Container

To use universal connector on data request from a mobile device from data source, create a Docker container on mobile platform server or in the cluster deployed based on Kubernetes, Deckhouse or OKD/OCP.

NOTE. If required, one can place a Docker container on a dedicated server or a data source server and start it manually.

Creating a Docker Component on Mobile Platform Server

To create a Docker component on a mobile platform server:

  1. Create a *.yml configuration file file containing a algorithm for converting input requests into a valid data source format, for example:

```yaml
version: '3.4'
services:
  custom-connector:
    image: <docker-registry>/<connector-repository>:<tag>
    restart: always
    networks:
      - backend
```

NOTE. A universal connector and a mobile platform server should be started within the same network. Specify this network as a value of the networks attribute.

  1. Start the Docker container using the created configuration file:

docker-compose -f <configuration file name>.yml up

docker-compose -f docker-compose.standalone.yml -f <configuration file name>.yml up

TIP. It is recommended to start a universal connector and a mobile platform server at the same time.

A Docker container will be created on a mobile platform server after executing the operations. Next, proceed to setting up a JSON or WEB data source connection.

Creating a Docker Container in Cluster

To create a Docker container in a cluster:

  1. Create a Docker container image containing an algorithm for converting input requests into a valid data source format, for example:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: custom-connector
spec:
  selector:
    matchLabels:
      app: custom-connector
  replicas: 2
  template:
    metadata:
      labels:
        app: custom-connector
    spec:
      containers:
      - name: custom-connector
        image: <docker-registry>/<connector-repository>:<tag>
        ports:
          # specify used port
        - containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: custom-connector
  labels:
    app: custom-connector
spec:
  type: LoadBalancer
  ports:
    # specify used
  - port: 8080
  selector:
    app: custom-connector
```

NOTE. A universal connector and a mobile platform server should be started in the same namespace. For details see the kubernetes documentation.

  1. Start a Docker container using the created image.

A Docker container will be created in a cluster after executing the operations. Next, proceed to setting up a JSON or WEB data source connection.

See also:

Creating a Universal Data Source Connector | Setting Up JSON Data Source Connection | Setting Up WEB Data Source Connection