DEV Community

Cover image for Setting Up Docker on My Hosting Server (selfmade.lab)
Bharath Kumar_30
Bharath Kumar_30

Posted on

Setting Up Docker on My Hosting Server (selfmade.lab)

Today I started setting up Docker on my hosting server as part of my project. My goal is to run PostgreSQL and backend services in containers and manage everything cleanly.

This post is a simple log of what I did today — step by step


Goal for Today

  • Set up Docker on my hosting server
  • Prepare environment for database and backend
  • Begin container-based development
  • Lab name: selfmade.lab

Step 1: Connected to My Server

First, I connected to my hosting server using SSH:

ssh root@your_server_ip
Enter fullscreen mode Exit fullscreen mode

After login, I confirmed I’m inside the server.


Step 2: Installed Docker

Then I installed Docker using basic commands:

apt update
apt install docker.io -y
Enter fullscreen mode Exit fullscreen mode

After installation, I started Docker:

systemctl start docker
systemctl enable docker
Enter fullscreen mode Exit fullscreen mode

To check if Docker is working:

docker --version
Enter fullscreen mode Exit fullscreen mode

Step 3: Tested Docker

I ran a simple test container:

docker run hello-world
Enter fullscreen mode Exit fullscreen mode

This confirmed Docker is installed and running correctly.


Step 4: Started PostgreSQL Container

Next, I started my database container:

docker run -d \
--name selfmade-postgres \
-e POSTGRES_PASSWORD=1234 \
-p 5432:5432 \
postgres
Enter fullscreen mode Exit fullscreen mode

Now PostgreSQL is running inside Docker.


Step 5: Opened Database Port

To allow external connection:

ufw allow 5432
Enter fullscreen mode Exit fullscreen mode

Step 6: Connected Using pgAdmin

From my local system, I connected using:

  • Host: your_server_ip
  • Port: 5432
  • Username: postgres
  • Password: 1234

Connection was successful


Step 7: Planning Next Steps

Today I only completed the base setup. Next, I plan to:

  • Use docker-compose for better management
  • Add FastAPI backend
  • Secure database using .env
  • Setup domain for selfmade.lab
  • Add Nginx for reverse proxy

Challenges I Faced

  • Initial confusion with Docker setup
  • Understanding server vs local environment
  • Port access configuration

But step by step, everything started working.


What I Learned Today

  • Docker can be installed easily on a server
  • Containers simplify backend setup
  • PostgreSQL runs smoothly inside Docker
  • Remote connection using pgAdmin is very useful

Final Thoughts

Today was a strong start for my project infrastructure. Setting up Docker on my hosting server gave me more confidence to move forward with deployment.

More updates coming soon as I build selfmade.lab


Top comments (0)