mirror of
https://github.com/mwisnowski/mtg_python_deckbuilder.git
synced 2026-02-20 15:04:08 +01:00
3.7 KiB
3.7 KiB
Docker Usage Guide for MTG Deckbuilder
Quick Start (Recommended)
Windows (PowerShell)
# Run with Docker Compose (easiest method)
.\run-docker.ps1 compose
Linux/macOS
# Make script executable (one time only)
chmod +x run-docker.sh
# Run with Docker Compose
./run-docker.sh compose
Manual Docker Commands
Windows PowerShell
# Build the image
docker build -t mtg-deckbuilder .
# Run with volume mounting for file persistence
docker run -it --rm `
-v "${PWD}/deck_files:/app/deck_files" `
-v "${PWD}/logs:/app/logs" `
-v "${PWD}/csv_files:/app/csv_files" `
mtg-deckbuilder
Linux/macOS/Git Bash
# Build the image
docker build -t mtg-deckbuilder .
# Run with volume mounting for file persistence
docker run -it --rm \
-v "$(pwd)/deck_files:/app/deck_files" \
-v "$(pwd)/logs:/app/logs" \
-v "$(pwd)/csv_files:/app/csv_files" \
mtg-deckbuilder
File Persistence Explained
The key to saving your files is volume mounting. Here's what happens:
Without Volume Mounting (Bad)
- Files are saved inside the container
- When container stops, files are lost forever
- Example:
docker run -it mtg-deckbuilder❌
With Volume Mounting (Good)
- Files are saved to your local directories
- Files persist between container runs
- Local directories are "mounted" into the container
- Example:
docker run -it -v "./deck_files:/app/deck_files" mtg-deckbuilder✅
Directory Structure After Running
After running the Docker container, you'll have these local directories:
mtg_python_deckbuilder/
├── deck_files/ # Your saved decks (CSV and TXT files)
├── logs/ # Application logs
├── csv_files/ # Card database files
└── ...
Troubleshooting
Files Still Not Saving?
- Check directory creation: The helper scripts automatically create the needed directories
- Verify volume mounts: Look for
-vflags in your docker run command - Check permissions: Make sure you have write access to the local directories
Starting Fresh
# Windows - Clean up everything
.\run-docker.ps1 clean
# Or manually
docker-compose down
docker rmi mtg-deckbuilder
Container Won't Start
- Make sure Docker Desktop is running
- Try rebuilding:
.\run-docker.ps1 build - Check for port conflicts
- Review Docker logs:
docker logs mtg-deckbuilder
Helper Script Commands
Windows PowerShell
.\run-docker.ps1 build # Build the Docker image
.\run-docker.ps1 run # Run with manual volume mounting
.\run-docker.ps1 compose # Run with Docker Compose (recommended)
.\run-docker.ps1 clean # Clean up containers and images
.\run-docker.ps1 help # Show help
Linux/macOS
./run-docker.sh build # Build the Docker image
./run-docker.sh run # Run with manual volume mounting
./run-docker.sh compose # Run with Docker Compose (recommended)
./run-docker.sh clean # Clean up containers and images
./run-docker.sh help # Show help
Why Docker Compose is Recommended
Docker Compose offers several advantages:
- Simpler commands: Just
docker-compose up - Configuration in file: All settings stored in
docker-compose.yml - Automatic cleanup: Containers are removed when stopped
- Consistent behavior: Same setup every time
Verifying File Persistence
After running the application and creating/saving files:
- Exit the Docker container
- Check your local directories:
ls deck_files # Should show your saved deck files ls logs # Should show log files ls csv_files # Should show card database files - Run the container again - your files should still be there!