docker for beginners on a vps
As a technical editor for Pixzo, I write your contribution directly, practically, and without fuss. Here is the rewritten version according to your structure and style rules.
Installing Docker on a Pixzo VPS
This article helps you install Docker on a Pixzo VPS (Debian/Ubuntu) and run your first container. Beginners, follow the steps exactly.
REQUIREMENTS - A Pixzo VPS with Debian 12 or Ubuntu 22.04 - SSH access to the VPS as root user or a user with sudo privileges - Basic terminal commands
STEPS
1. Update the system
Make sure all packages are up-to-date to avoid conflicts.
sudo apt update && sudo apt upgrade -y
2. Install required dependencies
Docker needs `ca-certificates`, `curl`, and `gnupg` to add the repository.
sudo apt install ca-certificates curl gnupg -y
3. Add the Docker GPG key This verifies the packages you download.
sudo curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
For Ubuntu, replace `linux/debian` with `linux/ubuntu`.4. Add the Docker repository Put the repository in your sources list.
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
For Debian, use `linux/debian` and $(lsb_release -cs) becomes bullseye or bookworm.5. Install Docker Engine and Compose
The core tools plus the Compose plugin. Docker Engine 24.x or higher will be installed.
sudo apt update && sudo apt install docker-ce docker-ce-cli docker-compose-plugin -y
6. Add your user to the docker group (optional but recommended)
This lets you avoid `sudo` with Docker commands. Replace `$USER` with your own username.
sudo usermod -aG docker $USER
Important: log out and back in (`exit` + SSH again) to activate the group.
7. Test Docker with the hello-world container
Start a test container to check that everything works.
docker run hello-world
8. Start your first real container: Nginx
Run Nginx on port 8080. This confirms that your containers have network access.
docker run -d -p 8080:80 --name nginx-test nginx:latest
VERIFICATION
Check whether the container is running:
docker ps
You will see `nginx-test` in the list. Then open in your browser: `http://
COMMON PROBLEMS
Problem 1: `permission denied` with docker commands Cause: user not in the docker group, or session not restarted. Solution: add the user (step 6) and log back in.
Problem 2: `Cannot connect to the Docker daemon` Cause: Docker service is not running. Solution: start the service with `sudo systemctl start docker`.
Problem 3: Nginx container does not start on port 8080 Cause: port 8080 is already in use or the firewall is blocking it. Solution: check with `sudo ss -tlnp | grep 8080`. Change the port in step 8 to, for example, 8081. Open the Pixzo firewall in the dashboard for port 8080.
This setup forms the foundation for any application you run on Pixzo.