×
Community Blog Working with Alibaba Cloud ECS - Part 1: Preparing the GPU-Container Environment

Working with Alibaba Cloud ECS - Part 1: Preparing the GPU-Container Environment

Part 1 of this series describes creating and preparing an environment to train or inference the AI model.

By Farruh

Nowadays, we have an extremely high-speed changing live environment. Most changes happen as a result of Artificial Intelligence (AI). The revolution does not only bring AI. It comes with other high-tech. One of the high-tech generators is containerization, and containers are part of MLOps. We start our MLOps journey with easy using containers. This article describes creating and preparing an environment to train or inference the AI model. Since Alibaba Cloud provides comprehensive tools and environments for deploying and using AI models, we will run example code and environment on it.

Containerization allows you to replicate your working environment quickly and easily. It makes it possible to initialize MLOps and reach the technical support L3 level quickly. Moreover, containerizing allows developers to generate the same results repeatedly on a different machine. However, creating containers is time-consuming and requires expert knowledge. As a container, we will use Docker images.

1

Docker is a popular open-source platform that helps automate the deployment, scaling, and management of applications and services. Its container-based approach to software development makes it easy to package and deploy applications consistently and repeatedly.

Alibaba Cloud is a leading cloud computing platform that offers a range of services, including Elastic Compute Service (ECS), which allows users to deploy and use Docker on any operating system (OS). We run ESC with Ubuntu OS as an example. However, ECS supports all OS and even user-defined OS images. Using Docker on ECS allows AI developers to build, deploy, and run their applications quickly and efficiently.


The use of Docker on ECS provides several benefits:

  1. It allows applications to run in isolated containers, meaning they can be deployed and run on any machine without worrying about dependencies or configuration issues. This makes it easy to move applications from one environment to another and ensures they can run seamlessly across multiple machines, making it possible to scale them as needed.
  2. It provides a range of tools that make it easy to manage applications' deployment, scaling, and maintenance. For example, Docker Compose is a tool that makes it easy to define and run multi-container applications, which means developers can define the dependencies between different containers and manage them as a single unit.
  3. It provides a range of platform and AI services (such as machine learning and deep learning algorithms), which can be used to build and deploy intelligent applications. It also provides a range of big data services (such as data warehousing and data analytics), which can be used to analyze vast amounts of data and make predictions accurately.

As an initial step, we signed up with an Alibaba Cloud account. Run instances that run an Ubuntu 20.04 operating system. Please see Create an instance by using the wizard for more information.

This article chose instances to run AI model inference. Developers not only consider inference models but also need to consider pricing, so an instance with T4 GPU will be an excellent choice to infer most of the AI models.

Deploy Docker

The Docker image should be connected to the ECS instance to deploy. Detailed information regarding ECS connection methods can be found at the following link. It's recommended to update the package sources list with the latest versions of the packages in the repositories. Then, install the packages to allow apt to use a repository over HTTPS:

2
OS version and related information

 apt update
 apt install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

It's recommended to look at the official documentation (Install Docker on Ubuntu) before installing any software. The steps to install Docker on Ubuntu 20.04 are listed below:

1.  It is recommended to check if the machine already has Docker installed. If so, uninstall existing versions first:

apt remove docker docker-engine docker.io containerd runc

2.  Add the official GPG key of Docker and set up the repository:

mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

3.  It needs to update apt and install Docker Engine, containerd, adn Docker Compose to get newly added repositories:

apt update
apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

The installation of Docker is finished, but we have to verify whether the installation has succeeded or not by checking its status and running the hello-world script:

systemctl status docker

3
The Docker status is running, which means we can go to the next step

docker run hello-world

4
Docker Image: Hello-World

The successful result can be defined after getting a similar response as shown in the pictures.

Let's check what Docker images the machine has:

docker images

5
Docker Image List

We have installed Docker and tested it. The next logical step will be to pull Docker images with TensorFlow and NVIDIA-Docker, which we will address in the next article.

0 4 1
Share on

Farruh

29 posts | 16 followers

You may also like

Comments

Farruh

29 posts | 16 followers

Related Products