TrueNAS Docker Network Endpoint Fix Guide
Problem Description
When starting apps in TrueNAS, you may encounter this error:
Error response from daemon: endpoint with name [container-name] already exists in network [network-name]This typically happens with errors like:
endpoint with name ix-mongodb-mongodb-1 already exists in network ix-mongodb_defaultendpoint with name ix-pgadmin-pgadmin-1 already exists in network ix-pgadmin_default
Common Causes
- Unexpected server shutdown - Power loss, system crash, or forced reboot
- App updates interrupted - Update process fails or is interrupted midway
- Docker daemon crashes - Docker service crashes while containers are running
- Force-stopping apps - Using kill commands instead of graceful UI stops
- Network timeouts during container lifecycle operations
Solution Steps
Step 1: Try Simple Restart (First Attempt)
- Open TrueNAS web interface
- Navigate to Apps
- Find the problematic app (e.g., MongoDB, pgAdmin)
- Click Stop and wait 30-60 seconds
- Click Start
If this doesn't work, proceed to manual cleanup.
Step 2: Access TrueNAS Shell
Option A: Web Interface
- In TrueNAS web interface, click the Shell icon in the top-right corner
- This opens a web-based terminal
Option B: SSH Access
- Enable SSH service in TrueNAS:
- Go to Services → SSH → Toggle ON
- Connect via SSH client:bash
ssh root@[your-truenas-ip]
Option C: Direct Console Access
- Use keyboard/monitor directly connected to TrueNAS server
- Press Alt+F2 (or F1) to access console login
Step 3: Manual Network Cleanup
Once in the shell, run these commands:
Check Current Docker Networks
bash
# List all Docker networks
sudo docker network ls
# Look for networks with your app name (mongodb, pgadmin, etc.)
sudo docker network ls | grep [app-name]Inspect the Problematic Network
bash
# Replace 'ix-mongodb_default' with your actual network name
sudo docker network inspect ix-mongodb_defaultThis shows you which endpoints are still connected.
Clean Up Method 1: Disconnect and Remove
bash
# Disconnect the stuck endpoint (replace names as needed)
sudo docker network disconnect ix-mongodb_default ix-mongodb-mongodb-1 --force
# Remove the network
sudo docker network rm ix-mongodb_defaultClean Up Method 2: Complete Container Cleanup
bash
# Stop all containers for the app (replace 'mongodb' with your app name)
sudo docker stop $(sudo docker ps -q --filter "name=ix-mongodb")
# Remove all containers for the app
sudo docker rm $(sudo docker ps -aq --filter "name=ix-mongodb")
# Remove the network
sudo docker network rm ix-mongodb_default
# Clean up any dangling networks
sudo docker network prune -fClean Up Method 3: Nuclear Option (if above don't work)
bash
# Stop all running containers
sudo docker stop $(sudo docker ps -q)
# Remove all containers
sudo docker rm $(sudo docker ps -aq)
# Remove all custom networks
sudo docker network prune -f
# Restart Docker service
sudo systemctl restart docker⚠️ Warning: Method 3 will stop ALL Docker containers, not just the problematic one.
Step 4: Restart the App
- Return to TrueNAS web interface
- Navigate to Apps
- Start your application
- The app should now start successfully
Prevention Tips
Best Practices
- Always use TrueNAS Apps UI to stop applications - don't use
docker killcommands - Wait for apps to fully stop before starting them again
- Perform graceful shutdowns when rebooting TrueNAS
- Don't interrupt app updates - let them complete fully
Pre-Shutdown Checklist
Before rebooting or shutting down TrueNAS:
- Stop all apps via the Apps interface
- Wait for all apps to show "Stopped" status
- Then proceed with shutdown/reboot
Monitoring
Check Docker status occasionally:
bash
# View running containers
sudo docker ps
# View all containers (including stopped)
sudo docker ps -a
# View networks
sudo docker network lsTroubleshooting Different Apps
MongoDB
bash
sudo docker network disconnect ix-mongodb_default ix-mongodb-mongodb-1 --force
sudo docker network rm ix-mongodb_defaultpgAdmin
bash
sudo docker network disconnect ix-pgadmin_default ix-pgadmin-pgadmin-1 --force
sudo docker network rm ix-pgadmin_defaultPostgreSQL
bash
sudo docker network disconnect ix-postgres_default ix-postgres-postgres-1 --force
sudo docker network rm ix-postgres_defaultGeneric Pattern
bash
sudo docker network disconnect ix-[APP-NAME]_default ix-[APP-NAME]-[SERVICE-NAME]-1 --force
sudo docker network rm ix-[APP-NAME]_defaultAdditional Docker Commands
Useful Diagnostic Commands
bash
# Show Docker system info
sudo docker system info
# Show Docker disk usage
sudo docker system df
# Show detailed container information
sudo docker inspect [container-name]
# Show container logs
sudo docker logs [container-name]
# Show real-time container logs
sudo docker logs -f [container-name]Emergency Cleanup Commands
bash
# Remove all stopped containers
sudo docker container prune -f
# Remove all unused networks
sudo docker network prune -f
# Remove all unused images
sudo docker image prune -f
# Remove all unused volumes (BE CAREFUL!)
sudo docker volume prune -f
# Complete system cleanup (NUCLEAR OPTION)
sudo docker system prune -a -f --volumes⚠️ Warning: Be very careful with volume pruning as it can delete your app data!
When to Seek Further Help
If these steps don't resolve the issue:
- Check TrueNAS logs in System → Advanced → Syslog
- Check Docker daemon logs:
sudo journalctl -u docker - Post on TrueNAS forums with:
- Complete error message
- Output of
sudo docker network ls - Output of
sudo docker ps -a - Your TrueNAS version
Recovery Checklist
- [ ] Tried simple restart via TrueNAS UI
- [ ] Accessed TrueNAS shell (web/SSH/console)
- [ ] Identified problematic network with
docker network ls - [ ] Inspected network with
docker network inspect - [ ] Disconnected stuck endpoint with
--forceflag - [ ] Removed problematic network
- [ ] Successfully restarted app via TrueNAS UI
- [ ] Verified app is running properly