Portainer
Install protainer via docker-compose
Docker-compose
Make folder for portainer
mkdir portainer && cd portainer
docker-compose.yml
version: '3.8' services: portainer: image: portainer/portainer-ce:latest container_name: portainer restart: always security_opt: - no-new-privileges:true volumes: - /etc/localtime:/etc/localtime:ro - /var/run/docker.sock:/var/run/docker.sock:ro - ./portainer-data:/data ports: - 9443:9443
Nginx
Create nginx config
sudo vim /etc/nginx/sites-available/portainer.example.com
Content of
portainer.example.com
server { listen 80; listen [::]:80; server_name portainer.example.com; location / { proxy_pass https://127.0.0.1:9443; proxy_http_version 1.1; proxy_set_header Host $host; } }
Create symbolic link
sudo ln -s /etc/nginx/sites-available/portainer.example.com /etc/nginx/sites-enabled/
Check nginx config
sudo nginx -t
Reload nginx config
sudo systemctl reload nginx