Install Sourcegraph with Docker Compose
If you want to migrate from the single-container server (
sourcegraph/server) to the Docker Compose deployment, refer to this migration guide.
It takes less than 5 minutes to run and install Sourcegraph using Docker Compose:
git clone https://github.com/sourcegraph/deploy-sourcegraph-docker cd deploy-sourcegraph-docker/docker-compose SOURCEGRAPH_VERSION="v3.24.1" git checkout $SOURCEGRAPH_VERSION docker-compose up -d
Once the server is ready (the
sourcegraph-frontend-0 service is healthy when running
docker ps), navigate to the hostname or IP address on port
80. Create the admin account, then you'll be guided through setting up Sourcegraph for code searching and navigation.
For next steps and further configuration options, visit the site administration documentation.
Note About Windows Installation
The docker compose installation requires a minimum of 8 CPU cores (logical) on the host machine in order to complete successfully. If using the Docker for Windows app, the default CPU count is only 2 which will result in errors during installation. You can go into the docker app settings->resources window to increase the CPU count to > 8 to resolve this issue.
(optional, recommended) Store customizations in a fork
- The fork can be public unless you plan to store secrets (SSL certificates, external Postgres credentials, etc.) in the repository itself.
releasebranch (to track all of your customizations to Sourcegraph. When you upgrade Sourcegraph's Docker Compose definition, you will merge upstream into this branch.
SOURCEGRAPH_VERSION="v3.24.1" git checkout $SOURCEGRAPH_VERSION -b release
- Commit customizations to the Sourcegraph Docker Compose yaml to your
Use the resource estimator to find a good starting point for your deployment.
Cloud installation guides
Cloud specific Sourcegraph installation guides for AWS, Google Cloud and Digital Ocean.
- Install Sourcegraph with Docker Compose on AWS
- Install Sourcegraph with Docker Compose on Google Cloud
- Install Sourcegraph with Docker Compose on DigitalOcean
To test new development builds of Sourcegraph (triggered by commits to
main), change all
index.docker.io/sourcegraph/* Docker image semver tags in docker-compose.yaml to
To keep this up to date, run
docker-compose pull to pull in the latest images, and run
docker-compose restart to restart all container to access new changes.