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

Published: (April 24, 2026 at 04:09 AM EDT)
2 min read
Source: Dev.to

Source: Dev.to

Step 1: Connect to the Server

ssh root@your_server_ip

After logging in, I confirmed I was inside the server.

Install Docker

apt update
apt install docker.io -y

Start and enable Docker:

systemctl start docker
systemctl enable docker

Verify the installation:

docker --version
docker run hello-world

The test container confirmed Docker is installed and running correctly.

Run PostgreSQL in a Container

docker run -d \
  --name selfmade-postgres \
  -e POSTGRES_PASSWORD=1234 \
  -p 5432:5432 \
  postgres

Allow external connections through the firewall:

ufw allow 5432

Connect from a local system (e.g., pgAdmin):

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

The connection was successful.

Next Steps

  • Use docker‑compose for better management.
  • Add a FastAPI backend.
  • Secure the database using an .env file.
  • Set up the domain for selfmade.lab.
  • Add Nginx as a reverse proxy.

Reflections

  • Initial confusion with Docker setup was resolved step by step.
  • Understanding the differences between server and local environments helped.
  • Port access configuration was straightforward once the firewall rule was added.
  • Docker installation on a server is simple, and containers greatly simplify backend setup.
  • PostgreSQL runs smoothly inside Docker, and remote connections via pgAdmin are very useful.

More updates will follow as I continue building selfmade.lab.

0 views
Back to Blog

Related posts

Read more »