Skip to main content
All CollectionsVPSVPS OS and Templates
How to Use the Docker VPS Template
How to Use the Docker VPS Template

Getting Started with Hostinger VPS Docker Template

Updated over 10 months 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 22.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.

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:

Step 1 - 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.

Step 2 - 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.

Step 3 - 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.

Step 4 - 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.

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?