Running Docker Containers on VeloxaHost: Patterns and Best Practices

Docker runs inside VeloxaHost container servers — no virtual machine needed. New servers come with a Docker-ready configuration; on a server created earlier, open it in the console and choose Enable Docker (the server restarts once). Here's how to get the most out of Docker on VeloxaHost.

Installing Docker

On a fresh Ubuntu 22.04 server:

curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER

Deploying with docker compose

Create /srv/myapp/docker-compose.yml:

services:
  web:
    image: myapp:latest
    restart: unless-stopped
    ports: ["80:8000"]
    environment:
      DATABASE_URL: ${DATABASE_URL}
  db:
    image: postgres:16-alpine
    restart: always
    volumes: [db_data:/var/lib/postgresql/data]
volumes:
  db_data:
docker compose up -d

Published ports are reachable the same way as anything else on the server: on a dedicated IPv4 address directly, or on the region's shared IPv4 address through a port in your server's block that you forward to them.

Using VeloxaHost Storage for Persistent Volumes

Mount a VeloxaHost storage volume (not an instance disk) for data you need to persist across instance replacements:

volumes:
  db_data:
    driver: local
    driver_opts:
      type: none
      device: /mnt/gh-storage/db
      o: bind

Networking Between Instances

Private networks and managed load balancers are planned, but not available in veloxa-us-east-1 yet. Servers are port-isolated from each other on the host's shared bridge. Keep services that talk only to each other in the same Compose project on one server, and restrict who can reach your published ports with a VeloxaHost firewall.

Monitoring Docker Containers

VeloxaHost's built-in monitoring tracks instance-level CPU and memory. For container-level visibility, add cAdvisor:

docker run -d --restart always \
  -p 8080:8080 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  gcr.io/cadvisor/cadvisor:latest

Then create a VeloxaHost alert for instance CPU > 80% to get notified when any container is misbehaving.