Installing and Setting Up MollySocket on a Raspberry Pi with Docker
Here's a step-by-step guide to install and run MollySocket on your Raspberry Pi using Docker.
Prerequisites
- Raspberry Pi (3B+ or newer recommended, 4 or 5 preferred)
- Raspberry Pi OS installed (64-bit recommended)
- SSH access to your Pi
- Internet connection
Step 1: Update Your System
First, connect to your Raspberry Pi via SSH and update the system:
sudo apt update
sudo apt upgrade -y
Step 2: Install Docker
Install Docker using the official installation script:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
Add your user to the docker group to run Docker commands without sudo:
sudo usermod -aG docker $USER
Log out and back in, or run this command to apply the group change:
newgrp docker
Verify Docker is installed correctly:
docker --version
docker run hello-world
Step 3: Create a Directory for MollySocket
Create a directory to store MollySocket configuration and data:
mkdir ~/mollysocket
cd ~/mollysocket
Step 4: Create Docker Compose File
Create a docker-compose.yml file:
nano docker-compose.yml
Add the following configuration:
version: "3.9"
services:
mollysocket:
image: ghcr.io/mollysocket/mollysocket:latest
container_name: mollysocket
ports:
- "3000:3000" # Web UI
- "3001:3001" # WebSocket
volumes:
- ./data:/app/data
restart: unless-stopped
environment:
- TZ=Etc/UTC # Change to your timezone
- ENABLE_REGISTRATION=true
- ADMIN_PASSWORD=changeme123 # CHANGE THIS!
Important: Change the ADMIN_PASSWORD to something secure!
Step 5: Install Docker Compose (if not already installed)
sudo apt install docker-compose -y
Step 6: Start MollySocket
Run MollySocket using Docker Compose:
docker-compose up -d
The -d flag runs it in detached mode (background).
Step 7: Verify Installation
Check if the container is running:
docker ps
You should see the mollysocket container listed.
View logs if needed:
docker-compose logs -f
Press Ctrl+C to exit the log view.
Step 8: Access MollySocket
Open a web browser and navigate to:
http://<your-raspberry-pi-ip>:3000
Log in with username admin and the password you set in the environment variables.
Managing MollySocket
Stop MollySocket:
docker-compose down
Start MollySocket:
docker-compose up -d
Restart MollySocket:
docker-compose restart
Update MollySocket:
docker-compose pull
docker-compose up -d
View logs:
docker-compose logs -f mollysocket
Alternative: Running Without Docker Compose
If you prefer not to use Docker Compose, you can run MollySocket directly with Docker:
# Create a volume for persistent data
docker volume create mollysocket_data
# Run the container
docker run -d \
--name mollysocket \
-p 3000:3000 \
-p 3001:3001 \
-v mollysocket_data:/app/data \
-e TZ=Etc/UTC \
-e ENABLE_REGISTRATION=true \
-e ADMIN_PASSWORD=changeme123 \
--restart unless-stopped \
ghcr.io/mollysocket/mollysocket:latest
Security Recommendations
- Change Default Password: Always change the default admin password
- Use a Firewall: Configure
ufw or iptables to restrict access
- Enable HTTPS: For production use, set up a reverse proxy with SSL
- Regular Updates: Keep Docker and MollySocket updated
- Backup Data: Regularly backup the
./data directory
Troubleshooting
Container won't start:
- Check logs:
docker-compose logs mollysocket
- Ensure ports 3000 and 3001 are not in use:
sudo netstat -tulpn | grep -E '3000|3001'
Can't access web interface:
- Check firewall settings
- Verify container is running:
docker ps
- Check Docker networking:
docker network ls
Permission issues:
- Ensure your user is in the docker group
- Check volume permissions
This setup provides a basic MollySocket installation. For production deployments, consider additional security measures like HTTPS, firewall rules, and regular backups.