A Docker container for Open Interpreter that follows Docker-in-Docker patterns, providing a secure, isolated, and production-ready environment for running Open Interpreter with full containerization workflow capabilities.
- Prerequisites
- Quick Start
- Configuration
- Usage
- Docker-in-Docker Capabilities
- Advanced Usage
- Security Notes
- Troubleshooting
- Docker installed and running
- Docker Compose (optional, for compose usage)
- API key for your chosen model (DeepSeek, OpenAI, Anthropic, etc.)
# Clone the repository
git clone https://github.com/legido-ai/docker-open-interpreter.git
cd docker-open-interpreter
# Copy the example environment file
cp .env.example .env
# Edit the .env file with your configuration
nano .env # Or use your favorite editor
# Build and start the container
docker-compose up --buildThe container supports various configuration options through environment variables. Copy .env.example to .env and customize the settings:
DEEPSEEK_API_KEY- Your DeepSeek API key (or your preferred model provider)
Pull the pre-built image from GitHub Container Registry:
docker pull ghcr.io/legido-ai/docker-open-interpreter:latestOr build locally from source:
docker build . -t docker-open-interpreterSet API key, for instance Deepseek:
export DEEPSEEK_API_KEY=sk-mykeyRun interactively:
docker run \
-it \
--rm \
--name agent \
-e DEEPSEEK_API_KEY=$DEEPSEEK_API_KEY \
-v /var/run/docker.sock:/var/run/docker.sock \
ghcr.io/legido-ai/docker-open-interpreter interpreter \
--model deepseek/deepseek-chatUsing the provided docker-compose.yml:
# Build and start in the foreground
docker-compose up --build
# Build and start in the background
docker-compose up -d --build
# Stop the container
docker-compose downThe container supports multiple model providers:
# In your .env file:
DEEPSEEK_API_KEY="your_deepseek_api_key"# In your .env file:
OPENAI_API_KEY="your_openai_api_key"# In your .env file:
ANTHROPIC_API_KEY="your_anthropic_api_key"This container supports Docker-in-Docker functionality, allowing Open Interpreter to run Docker containers from within the container:
- Mount the Docker socket:
/var/run/docker.sock:/var/run/docker.sock:ro - The container runs in privileged mode to enable Docker functionality
- The
appuseris added to the Docker group for socket access - Works with the host's Docker installation
-
Privileged Mode: The container runs in privileged mode to enable Docker-in-Docker functionality. This grants the container extended privileges that could potentially affect the host system. Only run this container with trusted code.
-
Docker Socket Access: Mounting the Docker socket gives the container access to create and manage containers on the host. This is necessary for Docker-in-Docker but presents a security risk if the container is compromised.
-
API Keys: Never commit API keys to version control. Use the
.envfile for local development, and use secure secret management in production. -
Non-root Execution: The container runs as the non-root user
appuser(UID 1000, GID 1000) to reduce potential impact of security vulnerabilities.
Symptom:
Got permission denied while trying to connect to the Docker daemon socket...
Solution:
- Ensure the Docker group ID matches between host and container:
- Check host Docker GID:
getent group docker - Set
DOCKER_GIDin.envto match - Rebuild the container:
docker-compose build
- Check host Docker GID:
Symptom:
AuthenticationError: Invalid API key
Solution:
- Verify the correct environment variable is set in
.env - Ensure the variable is being passed to the container
- Check the API key value is correct
Symptom:
docker-compose up fails to start service
Solution:
- Check Docker daemon is running:
systemctl status docker - Ensure Docker-in-Docker isn't conflicting with host Docker
- Verify all required environment variables are set
Symptom:
Error: Docker command not found or permission denied
Solution:
- Ensure privileged mode is enabled
- Verify the Docker socket is mounted:
/var/run/docker.sock:/var/run/docker.sock:ro - Check that the user is in the Docker group:
groups appuser(inside container)
The container includes a health check that verifies Open Interpreter is running:
- Runs every 30 seconds
- Times out after 10 seconds
- Starts checking after initial 5 second period
- Retries 3 times before marking container as unhealthy
Check container health status:
docker ps
# Look for "healthy" statusTo verify Open Interpreter is working inside the container:
# Enter the running container
docker exec -it open-interpreter bash
# Test the interpreter installation
python -c "import interpreter; print('Open Interpreter is installed')"To debug configuration values:
# Check environment variables inside the container
docker exec -it open-interpreter env
# Check if API keys are properly set
docker exec -it open-interpreter bash -c 'echo $DEEPSEEK_API_KEY'
# Note: This will show your API key - be careful in shared environmentsWe welcome contributions to this project. Please see our Contributing Guidelines for more information.
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.
If you encounter issues with this container, please file an issue in the GitHub repository.