Skip to main content

Creating an Application with a Container Image

There are different ways to deploy an application on the Arvancloud Cloud Container, and you can choose one based on your needs. If you prefer working with Docker, the Container Image method helps you build your applications using Docker images or container images in public or private repositories.

Log in to the Arvancloud panel and go to Create Application in the Cloud Container menu. Then select Container Image from the application creation methods.

Choosing the Image​

To choose your application's image, click Docker Image. In this section, you can use official images on Docker Hub, or public or private images from other repositories.

  • Official Docker Hub images

    You can easily find and install the image you want by searching for its name.

    After you select the image, its name and the latest tag are selected automatically.

    It is recommended that you don't use the latest tag to install the application, and instead enter the version you want when selecting the image.

  • Public images

    If you want to use an image in a public registry, simply enter the image's access address in Name and its version in Tag.

  • Private images

    If the image you want is in a private registry, besides the image's access address and tag, you also need to enter the username and password for accessing the registry. To do this, simply enable Private Image.

Finally, click Start to begin creating the application.

Application Creation Process​

After choosing the image, you enter the application creation process. In these steps, you can easily set the app's details and configuration based on your needs.

Basic Information​

First, choose the data center and infrastructure hosting your application. Currently, two regions, Bamdad and Shahriar, are available on Kubernetes. Then select one of your existing projects to deploy this application in, or create a new project.

On this page, you also need to choose a unique name for your application and a port for the container. This port is used to connect the application to a domain and is in fact the container's exposed port.

For example, consider the following command:

docker run -p 80:5000 my-web-app

In this example, the host's port 80 is mapped to the container's port 5000; that is, requests coming to the application's port 80 are sent to the container's port 5000. To implement this example setting in the Arvancloud panel, enter 5000 in the container port field.

In the next sections, you can specify more details such as network, disk, and environment variables. However, in each section you can click Continue to proceed with the default settings and go to the final step.

Network​

In this section, you can set the application's domain and private network settings for connecting to it.

Domain​

By selecting No Domain, you can set no domain for the application. But if you want your application to be reachable through a domain, you can choose a free Arvancloud subdomain or your own domain in this section.

  • Free Arvancloud subdomain

    With the free Arvancloud Cloud Container subdomain, you can put your service on the internet as quickly as possible. This subdomain includes the name you choose and the project name as a suffix.

    Your application must be able to respond to HTTP requests on port 80, and it doesn't need to respond on port 443.

    If you need requests sent to a port other than 80, use the settings in the next step (Network).

  • Custom domain

    You can connect your own domain to the Arvancloud Cloud Container application.

    Note that this domain must be registered in the CDN service in the same account. If you haven't registered the domain in the Arvancloud CDN yet, you can use New Domain or the guide to adding a domain to Arvancloud.

    In the same section, you can also connect the application to a subdomain of your own domain. If you need wildcard DNS, or to use * for all subdomains, you can contact Arvancloud support through a ticket.

Port​

In this section, you can manage the private network settings of your containers. This network is used to connect containers to each other. If other applications in this project need to access this application on a specific port, such as 3306, you need to open that port in this step. Your other applications can then access this application with a combination of name and port (name:port).

To define a new port, click Add New Item. Then select the TCP or UDP protocol and enter the application port and the exposed port.

For example, consider the following command:

docker run -p 3306:8080 my-web-app

In this example, the host's port 3306 is mapped to the container's port 8080; that is, requests coming to the application's port 3306 are sent to the container's port 8080. To implement this example setting in the Arvancloud panel, add an item with the TCP protocol, set the exposed port to 3306 and the application (container) port to 8080.

Disk​

In this section, you can add a disk (Persistent Storage) to your application. Disks in the Arvancloud Cloud Container are kept independently of the application. This means that even after the application is deleted, the disk and its contents can still be available at the project level.

Note that disks are charged regardless of their status and whether they're attached to an application.

To create a disk, click Add New Disk.

Then choose your disk's name and capacity and specify the disk's mount path in the application. This path can be any empty folder in your application's container.

By clicking Add Another Path, you can choose several paths for mounting the disk to the application.

Click Add to create the disk for the app. If you need more disks, you can also add them in this step.

Note that in the Arvancloud Cloud Container, you can only increase a disk's size; decreasing it isn't possible.

Settings​

Many applications and services need settings that they receive through files or environment variables and are configured by them. In the configuration step, you can specify your application's environment variables, configuration files, or run commands.

  • Environment variables

    Environment variables are key/value pairs the application needs to run. For more information, read the environment variables guide.

    You can upload a file of environment variables, or copy its text and paste it in this section.

    You can also enter them manually with Add Environment Variable.

  • Configuration files

    In this section, you can upload or enter the application's Secret or ConfigMap files. You also need to specify their mount path in this section. This path can be any path you like, provided its parent directory exists; for example, /etc/ in /etc/myapp/conf.json.

    Note that adding a file to a folder makes all previous files in it inaccessible. For example, when you add a configuration file at /etc/myapp/conf.json, if /etc/myapp/ already exists, all files in it become inaccessible.

  • Run command

    If a specific command must run each time the container starts, enter it in this section.

  • Zone settings (Zonal Topology Spread Constraints)

    When creating an application with a Docker image in the panel, you can set the details of the application's deployment zone in the Settings tab.

    With the Docker image method, only applications without disks (stateless) can use Multi Zone. To make stateful applications Multi Zone, you can use kubectl or Helm.

    • Automatic zone selection:

      When you enable this feature, the zone the application is deployed in is selected automatically. By disabling it, you can choose the zone(s) you want yourself.

      • Number of replicas:

        If you've disabled automatic zone selection, you can set how many instances of your Pod should be created in this section.

      • MaxSkew:

        This value specifies the maximum difference in replicas between zones.

    • Fallback behavior

      • DoNotSchedule:

        This option tells the scheduler not to schedule the Pod on a new zone if one of the selected zones becomes unavailable for any reason.

        This mode is used when strictly following the specified rules is more important, and the Pod shouldn't be scheduled until the conditions are met.

      • ScheduleAnyway:

        This option tells the scheduler to schedule the Pod in any case, even if the specified rules aren't followed. Also, if a zone becomes unavailable, the Pod is scheduled on a zone that already has replicas. In other words, this method may cause an unbalanced distribution of Pods.

        This mode is used when scheduling flexibility is more important than a balanced distribution of Pods.

Finally, click Continue.

Setting Resources​

In the last step, you can set the resource sizes, review the invoice, and get the infrastructure code being created.

  • Resources

    After choosing the processor generation, you can specify the CPU, RAM, and ephemeral storage sizes.

    These values can be decimals (multiples of 0.1).

    Note that if the RAM value is less than the application needs, the app may restart repeatedly.

    Also, any data stored inside the application on ephemeral storage is lost each time the application restarts. If your application needs to store files on disk, you must use Persistent Storage.

  • Invoice

    After setting the resources, you can review the cost estimate hourly, daily, weekly, or monthly, broken down by each component. You can also download and save this invoice.

    Whenever you turn off or delete your application, you aren't charged for CPU, RAM, or ephemeral storage.

  • Infrastructure code

    Behind the scenes of the process you've gone through so far, the Arvancloud Cloud Container has generated Kubernetes manifests based on your settings. If you're curious about the API used in this process or want to use it to learn Kubernetes, you can read the generated manifest or apply it with kubectl.

Finally, click Create to create your application.

Application Status​

After the creation process is complete, your application is created and can be seen in the Applications section.

For more details, until the app is installed and active, you can access its events, logs, and console from the quick access section.

From then on, you can manage your app's settings with the Manage Application guide.