Skip to main content

Docker on Hyperstack

Hyperstack virtual machines offer support for Docker containers, allowing users to run applications in an isolated and consistent environment. Docker enables you to package applications and their dependencies into a standardized unit for software development, ensuring your applications run reliably across different computing environments. This setup is ideal for continuous integration and deployment (CI/CD) pipelines, microservices architecture, and scalable web applications.

To get started with launching a virtual machine equipped with Docker, follow the steps outlined below:

Launch a virtual machine that supports Docker

To provision a Hyperstack virtual machine with Docker containers installed from the initial boot, follow the steps demonstrated in the video below.

Follow the procedures demonstrated in the video above to install Docker on your virtual machine from the initial boot:

  1. In Hyperstack, navigate to the 'Virtual Machines' page and click on "Deploy New Virtual Machine".

  2. After selecting your desired VM configuration, scroll to the bottom of the virtual machine deployment page and click the "Configure Additional Settings" dropdown.

  3. In the "Cloud-init Script" section, select the Bash syntax option, and include the following Docker configuration script in the provided field as shown below.

    Install Docker on Hyperstack script
    #!/bin/bash

    # Set up docker

    ## Add Docker's official GPG key:
    sudo apt-get update
    sudo apt-get install -y ca-certificates curl gnupg
    sudo install -m 0755 -d /etc/apt/keyrings
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --yes --dearmor -o /etc/apt/keyrings/docker.gpg
    sudo chmod a+r /etc/apt/keyrings/docker.gpg

    ## Add the repository to Apt sources:
    echo \
    "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
    "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
    sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    sudo apt-get update

    ## Install docker
    sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

    ## Add docker group to ubuntu user
    sudo usermod -aG docker ubuntu

    sudo apt-get install nvidia-container-toolkit -y

    ## Configure docker

    sudo nvidia-ctk runtime configure --runtime=docker

    sudo systemctl restart docker

    This configuration will install Docker packages on your virtual machine and run a test container that uses your NVIDIA GPUs.

    Cloud-init field

  4. After configuring your virtual machine, click "Deploy" to create the virtual machine.

  5. Once your virtual machine has been successfully deployed and is in an ACTIVE state, verify that Docker has been successfully installed with NVIDIA GPU enabled by executing the following command:

    Verify Docker installation
    docker run -it --gpus all nvidia/cuda:11.8.0-base-ubuntu22.04 nvidia-smi

    If the installation has been successful, the output should be similar to the following:

    Example output for successful installation
    +---------------------------------------------------------------------------------------+
    | NVIDIA-SMI 535.154.05 Driver Version: 535.154.05 CUDA Version: 12.2 |
    |-----------------------------------------+----------------------+----------------------+
    | GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
    | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
    | | | MIG M. |
    |=========================================+======================+======================|
    | 0 NVIDIA RTX A6000 On | 00000000:00:05.0 Off | Off |
    | 30% 36C P8 8W / 300W | 1MiB / 49140MiB | 0% Default |
    | | | N/A |
    +-----------------------------------------+----------------------+----------------------+

    +---------------------------------------------------------------------------------------+
    | Processes: |
    | GPU GI CI PID Type Process name GPU Memory |
    | ID ID Usage |
    |=======================================================================================|
    | No running processes found |
    +---------------------------------------------------------------------------------------+

Back to top