Docker VPS - Getting Started Guide

Docker VPS - Getting Started Guide

Your Docker VPS based on Ubuntu 24.04 is ready to go - Docker Engine and Docker Compose are already installed. No setup wizard, no configuration - just SSH in and start running containers.

Software Included

Component Version
Ubuntu24.04 LTS
Docker CE29.2.1
Docker Compose2.35.1
Docker Buildx0.22.0
containerd1.7.27
Portainer CE2.27.3
Fail2Ban1.0.2

Prerequisites

Before you begin, make sure you have:

  • An SSH client (Terminal on macOS/Linux, or PuTTY on Windows)

Step 1 - Get Your Server Credentials

Log in to your client panel and open your VPS service details. You will need:

  • IP address of your server
  • Root password

Step 2 - Connect via SSH

Open your terminal and connect to the server:

ssh root@your.server.ip

Enter the root password from your client panel when prompted.


Step 3 - Verify Docker Installation

Check that Docker is running:

docker --version
docker compose version

Run a test container to make sure everything works:

docker run hello-world

If you see "Hello from Docker!" - you're good to go.


Portainer - Web Interface for Docker

Portainer is a web-based UI for managing Docker. It's pre-installed and starts automatically on first VM boot.

Initial Setup:

  1. Open https://your.server.ip:9443 in your browser
  2. Create an admin password (minimum 12 characters)
  3. Click "Get Started" to connect to the local Docker environment

With Portainer you can manage containers, images, volumes and networks without using the command line.

First Login Timeout:

After the Portainer container starts, you have 5 minutes to create the admin password. In this template, Portainer starts automatically on first VM boot - the timeout counts from that moment.

If the time expires, you'll see "Your Portainer instance timed out for security purposes" when opening https://IP:9443.

To fix this, connect via SSH and restart the container:

docker restart portainer

Then open https://your.server.ip:9443 again and create your password.


Using Docker

Running Containers

Start a container from any image on Docker Hub:

# Run an Nginx web server on port 80
docker run -d --name webserver -p 80:80 nginx

# View running containers
docker ps

# Stop and remove the container
docker stop webserver
docker rm webserver

Docker Compose

Compose lets you define multi-container apps in a YAML file. Here's a quick example - Nginx + MySQL:

mkdir ~/myapp && cd ~/myapp

cat > docker-compose.yml <<'EOF'
services:
  web:
    image: nginx:alpine
    ports:
      - "80:80"
    volumes:
      - ./html:/usr/share/nginx/html
    depends_on:
      - db

  db:
    image: mysql:8.0
    environment:
      MYSQL_ROOT_PASSWORD: changeme
      MYSQL_DATABASE: myapp
    volumes:
      - db_data:/var/lib/mysql

volumes:
  db_data:
EOF

docker compose up -d

Useful Compose commands:

# Start services
docker compose up -d

# View logs
docker compose logs -f

# Stop services
docker compose down

# Stop and remove volumes (deletes data!)
docker compose down -v

Managing Images and Containers

# List running containers
docker ps

# List all containers (including stopped)
docker ps -a

# List downloaded images
docker images

# Remove unused images, containers, and networks
docker system prune

# Remove everything unused, including volumes (frees maximum space)
docker system prune -a --volumes

Post-Installation

Disk Space

Docker images can eat up disk space quickly. Keep an eye on it:

# Check overall disk usage
df -h /

# Check Docker-specific disk usage
docker system df

Running low? Clean up with docker system prune -a or contact support to resize your disk.

Fail2Ban - Brute-Force Protection

Your server comes with Fail2Ban pre-configured to protect SSH from brute-force attacks. After 5 failed login attempts, the IP is banned for 10 minutes.

Firewall

SSH (port 22) is open by default. When you publish container ports (like -p 80:80), they become accessible from the internet.

Check which ports your containers expose:

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

Updates

Docker and the OS don't update automatically. To update manually:

apt update && apt upgrade -y

Troubleshooting

Problem Solution
docker: command not found Run systemctl start docker and check with systemctl status docker
Cannot connect to Docker daemon The service may not have started yet. Run systemctl start docker
Container can't access the internet Run systemctl restart docker to reset networking
Port already in use Check what's using it: ss -tlnp | grep :80
No space left on device Clean up: docker system prune -a and check with df -h /
Forgot root password Use VNC console in your client panel to reset it


Was this article helpful?

mood_bad Dislike 0
mood Like 0
visibility Views: 33