This repository contains a script to automate the migration of Ollama from an existing Snap installation to a Docker container. It simplifies the process of containerizing your existing Ollama setup while preserving your existing models and data.
- Docker
- sudo privileges
- Ollama installed via Snap
-
Clone this repository:
git clone https://github.com/HomeDev68/ollama-snap-to-docker.git cd ollama-snap-to-docker
-
Make the script executable:
chmod +x migrate_ollama.sh
-
Run the migration script:
./migrate_ollama.sh
-
Follow the prompts in the script.
-
After the script completes, run the following command to apply the new alias:
source ~/.bashrc # OR source ~/.zshrc # if using zsh
- Stops the Ollama Snap service
- Creates a Docker volume for Ollama data
- Copies data from the Snap installation to the Docker volume
- Starts an Ollama Docker container
- Verifies the Ollama installation in Docker
- Adds an alias for easy use of Ollama in Docker (
requires the removal of the Ollama Snap installation
) - Optionally removes the Snap installation
After migration, you can use Ollama as before, but it will now run in a Docker container. The script adds an alias to your shell configuration, so you can use Ollama commands as usual:
ollama list
ollama run llama2
If you encounter any issues during or after migration, please check the following:
- Ensure Docker is running and you have necessary permissions.
- Verify that the Ollama container is running:
docker ps
- Check Ollama container logs:
docker logs ollama
If problems persist, please open an issue in this repository.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.