This repository contains Docker files and recommended configurations for a quick and minimal setup of the Google Gemini CLI, installing it in an isolated container to avoid direct installation in a host machine.
-
Google Gemini API Key
- See the Generating a Google Gemini Key reference for more information.
-
Docker
- Windows OS (Docker Desktop): Docker version 27.4.0, build bde2b89
- Linux/Mac OS: (applicable Docker versions)
Demo
gemini-demo2.mp4
-
Clone this repository.
git clone https://github.com/weaponsforge/gemini-cli.git
-
Create a
.env
file from the.env.example
file. Replace the value of theGEMINI_API_KEY
with your own Google Gemini API key.ID Description GEMINI_API_KEY Google Gemini API key GEMINI_MODEL Gemini model gemini-2.5-pro
(default)gemini-2.5-flash
,gemini‑1.5‑pro
, etcINFO: Exclude this from the
.env
file if there's no need to change the default model
💡 Other Gemini CLI environment variables are available in its Environment Variables & .env Files documentation.
-
(Optional) Put code repositories or directories for Gemini CLI inspection under the
"/projects"
directory.- See the projects/README.md file for more details on organizing your project repositories.
- INFO: this step is optional since the Gemini CLI does not require code repositories to answer general prompts.
-
Local build: build the Docker image.
- Run this command only during the initial installation or if there are changes to the
Dockerfile
. docker compose build
- Run this command only during the initial installation or if there are changes to the
-
Pull the pre-built Docker image: (Optional) This repository deploys the "latest" Docker image to Docker Hub on the creation of new Release/Tags. It is available at: https://hub.docker.com/r/weaponsforge/gemini-cli
- Use this step to skip building the image locally at step # 4.
- Pull the pre-built development Docker image:
docker pull weaponsforge/gemini-cli
-
Run the container.
docker compose up -d
-
Verify the container is running.
docker ps
-
Start the Gemini CLI from the container's command line.
docker exec -it weaponsforge-gemini-cli gemini
-
Use the Gemini CLI.
- Select a theme (eg., "ANSI Light")
- Type messages or prompts in the Gemini CLI's input message area.
- Use the
projects/
folder to reference codes or repositories within the Gemini CLI (mounted as Docker volumes) eg.,@projects/my-app
-
Exit the Gemini CLI.
- Press
Ctrl + C
- Press
-
Stop the container.
docker compose down
-
Verify the container stopped running. The following should yield empty logs.
docker ps docker ps -a
-
Cleanup: delete unused volumes.
docker volume prune
Click to view notes
(These steps require a Google account)
- Create one from Google AI Studio.
- Follow the prompts for creating an API key.
- Type a project name in which to create the API key.
-
INFO: You may also select an existing Google project in which to create the key.
- Copy the resulting API key in a safe and secure location.
- The Gemini CLI (using the free Gemini 2.5 Pro model) provides precise and accurate results but quickly exhausts the free subscription quotas when analyzing entire code bases. Use it alongside the (free-tier) Cursor AI code editor to maximize free accounts/trial usage.
@weaponsforge
20250630