Skip to main content

How to use the Docker VPS template at Hostinger

Getting started with Hostinger VPS Docker template

Updated over a week ago

Docker is a containerization platform that allows the creation of consistent, isolated environments working seamlessly across various computing environments, from development to production.

At Hostinger, we have an Ubuntu 24.04 VPS template with both docker-ce and docker compose pre-installed, making it easy for you to start deploying and managing your applications using Docker containers. Additionally, we provide Docker Manager - a web-based interface for managing containers without command-line knowledge.

If you don't have a VPS yet, you can check the available options here: Docker hosting 💡

To start using Docker, install the Docker template and follow these steps:

Connect to your VPS

Open Terminal (Linux/macOS) or Command Prompt/PowerShell (Windows) on your local computer and enter the following command:

ssh root@vps_ip

Replace vps_ip with your VPS IP address. You might be prompted to enter your VPS password.

Check the Docker Installation

To verify that Docker is installed, enter the following command:

docker --version

You will get the Docker version information if it's installed correctly. Now check Docker Compose with the following command:

docker compose --version

If installed correctly, this will display the version of Docker Compose.

Using Docker manager (recommended for beginners)

For a more user-friendly experience, Hostinger provides Docker Manager - a web-based interface that lets you deploy and manage Docker containers without using the command line.

To access Docker Manager:

1. Log in to your Hostinger control panel

2. Navigate to your VPS dashboard

3. Click on Docker Manager in the left sidebar

With Docker Manager, you can:

- Deploy containers using a visual interface

- Import Docker Compose files from GitHub or GitLab

- Monitor container status and logs

- Manage multiple projects easily

For detailed instructions, see our Docker Manager guide.

If you prefer using the command line, continue with the steps below.

Deploy your first Docker container

Pull a sample Docker image to test your setup. For instance, you can use the "Hello World" image:

docker run hello-world

This command will download and run the "Hello World" container.

Start using Docker Compose

Create a new directory for your Docker Compose project and navigate to it:

mkdir my-docker-project
cd my-docker-project

Once inside your project directory, create a docker-compose.yml file using a text editor and define your services, networks, and volumes. Now you can start your services using the following command:

docker compose up -d

This will start the services defined in your Docker Compose configuration by reading the configuration from the docker-compose.yml file in the current directory. The -d flag stands for detached so that the command runs in the background and returns to the command line instead of showing the logs of the running services.

Note: If you prefer a visual interface, you can use Docker Manager to create and deploy Docker Compose projects directly from your browser. See our Docker Manager guide for instructions.

Managing Docker compose services

To stop your Docker Compose services, use the following command:

docker compose down

To list all running containers, use:

docker ps

That's it! Now you know how to use Docker in your Hostinger VPS.

Make sure to explore the official Docker documentation and resources to learn more about optimizing and securing your containerized applications 💡

Did this answer your question?