In this tutorial, you will learn to install and configure Docker, Docker-compose, the Portainer container management solution on a Linux server and use it to create and manage Docker containers to run different apps. You will also learn to put these containers behind Nginx using the Nginx proxy manager.The Nginx proxy manager (NPM) is a reverse proxy management system running on Docker. NPM is based on an Nginx server and provides users with a clean, efficient, and beautiful web interface for easier management.
Table of Contents
Install Docker & Docker-Compose
apt install docker.io -y && apt install docker-compose
curl -sSL https://get.docker.com/ | sh systemctl start docker systemctl enable docker
curl -L "https://get.daocloud.io/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
Commands to install Portainer:
[root@arm1 ~]# docker volume create portainer_data portainer_data [root@arm1 ~]# docker run -d -p 9000:9000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
- Make sure your VPS’s 9000 port has been opened.
- Install Docker and Docker-Compose
- Create a docker-compose.yml file similar to this:
- Bring up your stack by running
- Log in to the Admin UI
When your docker container is running, connect to it on port
81 for the admin interface. Sometimes this can take a little bit because of the entropy of keys.
Default Admin User:
Immediately after logging in with this default user you will be asked to modify your details and change your password
Open the URL
https://<yourserverIP>:81 in your browser, and you will get the following screen. Enter the following default credentials to sign in.
[email protected] Password: changeme
Next, you will be immediately asked to set a name and an email address. Click the Save button, and you will be asked to create a new password. Click the Save button again to get started.
Visit the Hosts >> Proxy Hosts and click the Add Proxy Host button.
Enter the domain name as
portainer.example.com. Choose the scheme as
https. Enter the name of the container as the Forward Hostname and 9443 as the Forward port. Check the options Block Common Exploits and Websockets Support options.