Nginx Proxy Manager Autostart
Auto start the Nginx Proxy Manager (NPM) Docker container
To start the Nginx Proxy Manager (NPM) Docker container automatically on system boot, you need to use the restart: unless-stopped (or restart: always) policy in your docker-compose.yml file and ensure the Docker daemon itself is enabled to start on boot.
Method 1: Using docker-compose.yml (Recommended)
The most robust and common method is to specify a restart policy within your Docker Compose configuration. Navigate to your NPM directory: Open a terminal and go to the directory containing your docker-compose.yml file. bash cd ~/nginx-proxy-manager/ Edit the docker-compose.yml file: Open the file in a text editor (e.g., nano). bash nano docker-compose.yml Add or modify the restart policy: Ensure the services section for app (and db if you are using a separate database container like MariaDB) includes restart: unless-stopped. The final file should look similar to this example from the official documentation: yaml version: ‘3’ services: app: image: ‘jc21/nginx-proxy-manager:latest’ restart: unless-stopped ports: - ‘80:80’ - ‘443:443’ - ‘81:81’ volumes: - ./data:/data - ./letsencrypt:/etc/letsencrypt
db:
image: ‘jc21/mariadb-aria:latest’
restart: unless-stopped
… (other db configurations)
Save and exit: Press Ctrl + X, then Y, then Enter to save the file and exit the editor. Bring up the stack: Run the following command to apply the changes. This will recreate the containers with the new restart policy. bash sudo docker compose up -d
Nginx Proxy Manager Nginx Proxy Manager +4
Method 2: Ensure Docker Service Starts on Boot
Your host operating system must be configured to start the Docker service automatically when the system boots. This is typically the default behavior when Docker is installed from official repositories, but you can verify it: Stack Overflow Stack Overflow Check Docker status: bash sudo systemctl status docker Look for “Active: active (running)” and “Loaded: loaded (…; enabled;…)”. Enable the Docker service (if not already enabled): bash sudo systemctl enable docker
After a reboot, the unless-stopped policy will ensure the containers start up automatically as long as they were running when the system went down (or were explicitly started at least once).