Skip to main content

Build Application with Container Image

There are different solutions for deploying the application on Arvancloud Container platform, which you can choose based on your needs. If you prefer to work with Docker, the "Container Image" method helps you build your applications using Docker or container images in public or private repositories.

Enter Arvancloud's user panel and the "New Application" section in the Cloud Container menu. Then choose "Container Image".

Select Image

In this section, you can use official images available in Docker Hub or public or private images from other repositories.

  • DockerHub Official Images

    You can easily find and install the desired image by searching its name.

​ After selecting the image, the name and the latest tag will be selected automatically.

It is recommended not to use the latest tag to install the application and enter the desired version when selecting the image.

  • Public Images

    If you want to use an Image in public registries, just enter the image address in the "Name" section and its version in the "Tag" section.

  • Private Images

    If the image you want is in a private registry, you need to enter the username and password to access the registry in addition to the URL and application tag. For this, activate the private image option.

At the end, click on the start button to start the process of building the application.

Create Application

After selecting the image, you will enter the application creation process. In these steps, you can easily choose the details and configuration of the app based on your needs.

Application Details

First, you need to choose the data center and infrastructure to host your application. Currently, two regions, Bamdad and Shahriar, are available. Then choose one of the existing projects to deploy this application or create a new project.

Also on this page, you should choose a unique name for your application and a port for the container. This port is used to connect the application to the domain and is the exposed port of the container.

For example, consider the following command:

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

In this example, port 80 of the host is mapped to port 5000 of the container; This means that incoming requests to port 80 of the application are sent to port 5000 of the container. To implement these sample settings in the Arvancloud user panel, you must enter 5000 in the container port section.

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

Network

In this section, you can specify the domain and private network settings of the application.

Domain

You have the option to not set any domain for the application by selecting "No Domain" mode. But if you want your application to be available via a domain, in this step you can choose Arvancloud's free subdomain or your custom domain.

  • Arvancloud Free Subdomain

    With Arvancloud's free cloud container subdomain, you can publish your service on the internet immediately. This subdomain will contain your chosen name and the project name as a postfix.

    Your application must be able to respond to HTTP requests on port 80 and there is no need to respond on port 443.

    If you need to send requests to a port other than 80, use the Port settings.

  • Custom Domain

    You can connect your own domain to Arvancloud container application.

    Note that this domain must be registered in the same user account and in the CDN service. If you haven't registered the domain in Arvancloud's CDN yet, you can use the "New Domain" button or the domain registration guide in Arvancloud.

    Also, in this section, you can connect the application to a subdomain of your personal domain. If you need to use wildcard DNS or use * for all subdomains, you can contact Arvancloud support via ticket.

Port

In this section, you can manage the private network settings of your containers. This network is used to connect containers together. If other applications in this project need access to this application on a specific port such as 3306, you must open this port at this stage. Then your other applications can access this application by combining name and port (name:port).

Click the "Add New Item" button to define a new port. Then enter the application port and exposed port by selecting TCP or UDP protocol.

For example, consider the following command:

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

In this example, host port 3306 is mapped to container port 8080; This means that incoming requests to port 3306 of the application are sent to port 8080 of the container. To implement these sample settings in the Arvancloud user panel, you must do the following:

Disk (PVC)

Here, you can add disks or persistent storage to your application. Disks are stored independently of the application. This means that even after deleting the application, the disk and its content can still be available at the project level.

Note that the cost of disks is calculated regardless of the status and connection to the application.

To create a disk, click the "Add New Disk" button.

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

By clicking on the "Add another path" option, you can choose several paths to mount the disk to the application.

Click the "Add" button to create the disk for the app. Also, if you need more disks, you can add them at this stage.

Keep in mind that in Arvancloud container, you can only increase the disk size and not decrease it.

Settings

Many applications and services require settings that are received through files or environment variables and are configured through them. In the Settings tab, you can upload environment variables, configuration files, or runtime commands for your application.

  • Environment Variables

    Environment Variables are Key/Value pairs that the application needs to run. For more information on this, you can read the environment variables guide.

    You can upload a file for Env variables, or copy and paste the text here.

    You can also enter them manually using the "Add environment variable" option.

  • Config Files

    In this section, you can upload or import Secret or Configmap files of the application. You should also specify its deployment path in this section. This path can be any desired path, provided that its parent directory exists; For example, /etc/ in /etc/myapp/conf.json.

    Note that by adding a file to any folder, all previous files will become inaccessible. For example, by adding the configuration file in the etc/myapp/conf.json/ path, if /etc/myapp/ already exists, all the files inside it will be unavailable.

  • Runtime Command

    If a specific command must be executed every time the container is run, enter it in this section.

At the end, click on the "Continue" button.

Final Step

In the last step, you can determine the size of the resources, check the bill and get the code of the infrastructure you are building.

  • Resources

    After choosing the processor generation, you can specify the size of CPU, RAM and Ephemeral Storage.

    These values can be decimal (a multiple of 0.1).

    Note that if the amount set for RAM is less than the amount required by the application, the application may restart frequently.

    Also, any data storage inside the application and on Ephemeral Storage will be lost every time the application is restarted. If your application needs to store a file on disk, you should use Persistent Storage.

  • Bill

    After determining the resources, you can check the cost estimate hourly, daily, weekly or monthly and separately for each component. You can also download and save this invoice.

    Whenever you turn off or delete your application, you will not be charged for CPU, RAM and temporary memory.

  • Infrastructure Code

    Behind the scenes of the process you've gone through so far, Arvancloud Container has generated Kubernetes manifests based on your configuration. If you are curious about the API used in this process or want to use it to learn Kubernetes, you can read the generated manifest or implement it using Kubectl.

At the end, click on the "Create" button to create your application.

Application Status

Once the build process is complete, your app will be visible in the Applications Section.

Also, for more details, you can access the events, log, and console of the application in the quick access section until the end of the installation and activation.

From now on, you can manage your app's settings using "Manage Application" guide.