— AI, MLOps, Linux — 1 min read
In this technical notes, I'll walk through the process of setting up an Ubuntu server to host Docker Compose services. This setup includes installing Docker, configuring the NVIDIA Container Toolkit (if required for GPU-based workloads), and running a sample service with Docker Compose.
Before start, ensure you have the following:
First, connect to your server via SSH and update the package list. It's always a good practice to ensure your system is up-to-date.
1sudo apt update2sudo apt upgrade -yDocker is a platform that allows you to build, ship, and run applications in lightweight containers. To install Docker, use the official installation script:
1curl -fsSL https://get.docker.com -o get-docker.sh2sudo sh get-docker.shAfter installation, add your user to the docker group so you can run Docker commands without sudo:
1sudo usermod -aG docker $USERApply the group changes by logging out and logging back in, or use:
1su - $USERVerify the Docker installation:
1docker --versionIf your service requires GPU acceleration, install the NVIDIA Container Toolkit.
1curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \2 && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \3 sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \4 sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list1sudo apt-get update2sudo apt-get install -y nvidia-container-toolkitnvidia-docker2:1sudo apt-get install -y nvidia-docker21sudo systemctl restart dockerDocker Compose simplifies the process of defining and running multi-container Docker applications. Install it as follows:
1sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-composeMake the binary executable:
1sudo chmod +x /usr/local/bin/docker-composeVerify the installation:
1docker-compose --versionNavigate to the directory containing your docker-compose.yml file. This file defines the services for your application. Build the Docker images:
1cd /path/to/your/project2docker-compose buildStart your service with Docker Compose:
1docker-compose up -dCheck the running containers:
1docker-compose psWe now have a fully functional Ubuntu server configured to run Docker Compose services. With this setup, you can deploy microservices, web applications, and other containerized workloads efficiently. If our application requires GPU acceleration, the NVIDIA Container Toolkit ensures seamless integration.