If you want to run and manage containers effortlessly, Docker, Docker Compose, and Portainer make an unbeatable combo. In this guide, we’ll walk you through installing and configuring everything on Ubuntu 24, using Nginx Proxy Manager and a UFW firewall. We’ll also cover a common Portainer timeout issue and how to fix it!
What is Docker?
Docker is a platform for developing, shipping, and running applications in lightweight, portable containers. It simplifies deployment by packaging apps and their dependencies together.
- Use Cases: Application deployment, microservices, CI/CD, and running isolated services.
What is Docker Compose?
Docker Compose is a tool to define and run multi-container Docker applications using a single YAML file. It simplifies container orchestration.
- Use Cases: Running complex apps with multiple services (e.g., web + database) and managing development environments.
What is Portainer?
Portainer is a web-based Docker management tool that provides a graphical interface to manage containers, images, networks, and volumes.
- Use Cases: Visual Docker management, monitoring, and easier control over your Docker environment.
What is Nginx Proxy Manager?
Nginx Proxy Manager is a web-based tool for managing Nginx reverse proxy configurations with built-in support for Let’s Encrypt SSL.
- Use Cases: Securely exposing services to the internet, managing subdomains, and handling HTTPS certificates.
Step 1: Update Your System
Update your system packages:
sudo apt update && sudo apt upgrade -yStep 2: Install Docker
- Install Docker dependencies:
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y- Add Docker’s GPG key and repository:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list- Install Docker:
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io -y- Enable and start Docker:
sudo systemctl enable docker
sudo systemctl start docker- Add your user to the Docker group:
sudo usermod -aG docker $USERLog out and back in to apply the group change.
Step 3: Install Docker Compose
- Download Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose- Make it executable:
sudo chmod +x /usr/local/bin/docker-compose- Verify installation:
docker-compose --versionStep 4: Install Portainer
- Create a Docker volume for Portainer:
sudo docker volume create portainer_data- Run the Portainer container:
sudo docker run -d \
--name=portainer \
--restart=always \
-p 8000:8000 \
-p 9443:9443 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce:latestStep 5: Configure UFW (Firewall)
Open the necessary ports:
sudo ufw allow 80/tcp # HTTP
sudo ufw allow 443/tcp # HTTPS
sudo ufw allow 9443/tcp # Portainer GUI (for direct access)
sudo ufw allow 8000/tcp # Portainer AgentEnable UFW if not already enabled:
sudo ufw enableStep 6: Configure Nginx Proxy Manager
Set up a proxy host:
- Domain Name:
your-subdomain.example.com - Forward Hostname/IP:
localhost or 127.0.0.1 - Forward Port:
9443 - Scheme:
https - Enable Websockets
- Enable SSL (via Let’s Encrypt)

Save and deploy the proxy host.
Common Portainer Timeout Issue & Fix
Sometimes, you might see this error:
“Your Portainer instance timed out for security purposes. To re-enable your Portainer instance, you will need to restart Portainer.”
This happens when your session remains idle for too long. To fix it, simply restart the Portainer container with this command:
sudo docker restart portainerAfter restarting, you can access your dashboard again via:
https://your-subdomain.example.comWrapping Up
With Docker, Docker Compose, and Portainer set up, and Nginx Proxy Manager handling your subdomains, you have a powerful, flexible, and secure environment to manage containers. If you hit the Portainer timeout issue, now you know how to fix it in seconds!
Need help with advanced configurations or want us to cover another topic? Let us know in the comments below! 🚀
About EngineerHow.com: EngineerHow.com is your go-to platform for IT and engineering tutorials. We simplify complex topics like server setup, networking, and civil engineering, helping professionals, enthusiasts, and businesses thrive with practical, easy-to-follow guides.
What do you think about this setup? Have you encountered any issues? Let us know in the comments!


