Setup Nginx, Docker, and Portainer on VPS

image from pixels

Most important if setup newest VPS is setup the docker and docker-compose, In this case, I will share how to setup Docker, Nginx, docker-compose

Install Docker

To Install Docker we need to install some dependencies, in this case, my VPS is Debian based so use this command to get the dependencies

apt install curl gnupg2 ca-certificates lsb-release

Get the key

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Now add in the repo

echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null

Then install the docker

apt update && apt-get install docker-ce docker-ce-cli containerd.io
docker-engine

Install Docker Compose

Now Install docker-compose for multi-container with YAML configuration, install with this command

apt -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common

Getting Docker Compose

curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Change owner for docker-compose

chmod +x /usr/local/bin/docker-compose

Linking the compose to the system

ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

Checking the version

docker-compose --version
checking the version

Install Portainer UI

To simplify docker management we need a tool manager to manage containers and docker images

Creating Directory to store portainer data

mkdir ~/portainer

Pull Portainer latest version

docker pull portainer/portainer

Tag on Directory

docker pull portainer/portainer

running the container

export CONT_NAME="portainer" # Create container docker run -d -p 9000:9000 \ --restart always \ -v /var/run/docker.sock:/var/run/docker.sock \ -v ~/portainer:/data \ --name ${CONT_NAME} \ portainer

open the portainer on web browser

portainer on Server

Installing Web Service Nginx

Installing web service for non-docker apps

apt install curl gnupg2 ca-certificates lsb-release nginx

Conclusion

that’s how to setup docker for a new VPS so it’s ready to be used for production or staging servers with a manager that makes the process of deploying and testing applications easier

--

--

--

Interesting with Blockchain and Opensource Project my journal: https://www.perykun.xyz/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

HIPAA Compliant API For Customer Profiling

Kubernetes Services Explained

Argo CD Installation and Setup on Minikube — Part 2

ArgoCD login page

Flutter Login Page Validator Made Easy 🔥 .

Hot potato work

Is There Any Free API To Get Metal Rates In South African Rand?

Cross language API schemas with Bazel

Begginers Guide To APIs For Precious Metals Rates

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Feri Lukmansyah

Feri Lukmansyah

Interesting with Blockchain and Opensource Project my journal: https://www.perykun.xyz/

More from Medium

Nginx server error

Google Cloud Platform Guide

Setup https for nginx on AWS EC2 Linux Instance using docker + certbot(Lets Encrypt)

How to use Jenkins to deploy apps directly from GitHub to AWS EC2

Getting Started Page for Jenkins