Docker has revolutionized how developers deploy applications. Instead of wrestling with dependency conflicts and environment inconsistencies, containers let you package your software with everything it needs to run anywhere. If you're looking for a reliable, high-performance VPS to run Docker in production, this Vultr Docker setup guide will get you running in under 15 minutes.

Why Choose Vultr for Docker Hosting?

Vultr stands out as an excellent Docker host for several reasons. Their globally distributed infrastructure offers 32+ locations, ensuring low latency regardless of your user base. The high-performance SSD instances start at just $5/month, making containerized deployment accessible for projects of any scale.

Compared to other cloud providers, Vultr provides:

  • Native block storage expansion without downtime
  • Full KVM virtualization with dedicated resources
  • One-click OS reinstalls and snapshots
  • API-driven infrastructure for automation

If you're comparing providers, check out our cloudbet guide for infrastructure insights, or see our Vultr vs AWS comparison for detailed pricing analysis.

Prerequisites for This Docker Setup

Before we begin, ensure you have:

  • A Vultr account (sign up here)
  • A Vultr instance running Ubuntu 22.04 LTS or 24.04 LTS
  • SSH access to your server
  • Basic command line familiarity

Step 1: Initial Server Configuration

Start by updating your system packages and installing essential tools:

sudo apt update && sudo apt upgrade -y
sudo apt install -y curl wget git vim ufw fail2ban

Create a non-root user with sudo privileges for better security:

sudo adduser deployer
sudo usermod -aG sudo deployer
sudo su - deployer

Step 2: Install Docker on Vultr Ubuntu

Docker provides an official convenience script, but for production environments, we recommend manual installation for better control. Here's the recommended approach:

Install Dependencies

sudo apt install -y ca-certificates curl gnupg lsb-release

Add Docker GPG Key and Repository

sudo mkdir -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

Install Docker Engine

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

Add your user to the Docker group to run Docker without sudo:

sudo usermod -aG docker $USER
newgrp docker

Step 3: Verify Docker Installation

Confirm Docker is running correctly:

docker --version
docker run hello-world

You should see Docker pulling the hello-world image and displaying a confirmation message. This validates that your container runtime is fully functional.

Step 4: Configure Docker for Production

For production deployments, configure Docker's logging and storage drivers:

sudo mkdir -p /etc/docker
cat << 'EOF' | sudo tee /etc/docker/daemon.json
{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  },
  "storage-driver": "overlay2",
  "live-restore": true,
  "userland-proxy": false
}
EOF

Restart Docker to apply changes:

sudo systemctl restart docker
sudo systemctl enable docker

Step 5: Deploy Your First Container

Let's deploy a practical application—a Node.js web server—to demonstrate real-world usage:

Create Your Project

mkdir -p ~/projects/api-server && cd ~/projects/api-server
cat << 'EOF' > Dockerfile
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
EXPOSE 3000
CMD ["node", "server.js"]
EOF

cat << 'EOF' > server.js
const http = require('http');
const server = http.createServer((req, res) => {
  res.writeHead(200, {'Content-Type': 'application/json'});
  res.end(JSON.stringify({status: 'ok', timestamp: Date.now()}));
});
server.listen(3000, '0.0.0.0', () => console.log('Server running on port 3000'));
EOF

cat << 'EOF' > package.json
{"name":"api-server","version":"1.0.0","main":"server.js","dependencies":{}}
EOF

Build and Run

docker build -t api-server .
docker run -d --name api-server -p 80:3000 --restart unless-stopped api-server

Test your container:

curl http://localhost
# {"status":"ok","timestamp":1748729600000}

Step 6: Set Up Docker Compose for Multi-Container Apps

Most real applications require multiple services (database, cache, frontend). Docker Compose simplifies this:

cat << 'EOF' > docker-compose.yml
version: '3.8'
services:
  api:
    build: .
    ports:
      - "80:3000"
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3000"]
      interval: 30s
      timeout: 10s
      retries: 3

  redis:
    image: redis:7-alpine
    ports:
      - "6379:6379"
    restart: unless-stopped
    volumes:
      - redis-data:/data

volumes:
  redis-data:
EOF

Launch the entire stack:

docker compose up -d
docker compose ps

Step 7: Secure Your Docker Host

Configure UFW firewall rules for Docker:

sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw --force enable
sudo ufw status

Step 8: Set Up Automatic Updates

Keep your Docker host secure with unattended upgrades:

sudo apt install -y unattended-upgrades
sudo dpkg-reconfigure -plow unattended-upgrades

Monitoring Your Docker Containers

For production monitoring, install Portainer or use Docker's native stats:

docker stats
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"

Portainer provides a web UI for container management:

docker run -d -p 9443:9443 --name portainer \
  --restart unless-stopped \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v portainer-data:/data \
  portainer/portainer-ce:latest

Troubleshooting Common Docker Issues

Docker Daemon Not Starting

sudo systemctl status docker
sudo journalctl -u docker -n 50

Port Conflicts

sudo lsof -i :80
# Kill conflicting process or change container port mapping

Out of Disk Space

docker system df
docker system prune -a --volumes

Conclusion

Your Vultr Docker setup is now complete and production-ready. With containers running smoothly on high-performance SSD storage, you're equipped to deploy scalable applications efficiently. Remember to implement regular backups using Vultr's snapshot feature for disaster recovery.

For more advanced deployments, explore our guides on Vultr Kubernetes setup and cloud infrastructure best practices.

Ready to Get Started?

Deploy your first Docker container on Vultr's high-performance infrastructure.

Create Your Vultr Account