|
| 1 | +# Running Gitpod as a Docker container |
| 2 | + |
| 3 | +For smaller setups or to test Gitpod Self-Hosted on your local machine you can run a complete Gitpod installation as a Docker container. The Gitpod Docker image [`gitpod-k3s`](https://console.cloud.google.com/gcr/images/gitpod-core-dev/EU/build/gitpod-k3s) is based on the [`k3s` Docker image](https://hub.docker.com/r/rancher/k3s). |
| 4 | + |
| 5 | +## Running Gitpod using `docker run` |
| 6 | + |
| 7 | +The easiest way to get Gitpod up with `docker run` is as follows: |
| 8 | + |
| 9 | +``` |
| 10 | +$ docker run \ |
| 11 | + --privileged \ |
| 12 | + --name gitpod \ |
| 13 | + --publish 443:443 --publish 80:80 \ |
| 14 | + --env DOMAIN=10-0-0-5.ip.mygitpod.com \ |
| 15 | + eu.gcr.io/gitpod-core-dev/build/gitpod-k3s |
| 16 | +``` |
| 17 | + |
| 18 | +Make sure to replace `10-0-0-5` with the IP address of your machine (replace dots with dashes). [See below](#customize-your-gitpod-installation) how to customize your installation (e.g. with an own domain). |
| 19 | + |
| 20 | +## Running Gitpod using `docker-compose` |
| 21 | + |
| 22 | +To run Gitpod you can also use our sample [`docker-compose.yaml`](./examples/gitpod/docker-compose.yaml) file. |
| 23 | + |
| 24 | +At first, you need to set your domain as an environment variable. You can do this by creating an `.env` file next to the `docker-compose.yaml` file like this: |
| 25 | + |
| 26 | +``` |
| 27 | +DOMAIN=10-0-0-5.ip.mygitpod.com |
| 28 | +``` |
| 29 | + |
| 30 | +After that, simple run: |
| 31 | +``` |
| 32 | +$ docker-compose up |
| 33 | +``` |
| 34 | + |
| 35 | +## Customize your Gitpod installation |
| 36 | + |
| 37 | +### Custom `values.yaml` files |
| 38 | + |
| 39 | +You can add custom `values.yaml` files for the Gitpod `helm` installation. Simple add a `*.yaml` file to the `/values/` directory of the Docker container. All files are merged to one file where the files in the `/values/` folder override values of the built-in file in case of a conflict. |
| 40 | + |
| 41 | +### Use your own domain and HTTPS certificates |
| 42 | + |
| 43 | +Instead of using the `*.ip.mygitpod.com` domain you can also use your custom domain like `gitpod.example.com` with your own HTTPS certificates. You just need to set the `DOMAIN` environment variable accordingly and mount a directory with your certificates as `/certs` in the Gitpod Docker container. |
| 44 | + |
| 45 | +### Specify a base domain |
| 46 | + |
| 47 | +Instead of setting the environment variable `DOMAIN` you could also set the variable `BASEDOMAIN`. In that case, the Gitpod Docker image sets the Gitpod Domain to `gitpod.$BASEDOMAIN`. This is used in the [gitpod-gitlab example](./examples/gitpod-gitlab/docker-compose.yaml). |
| 48 | + |
| 49 | +### Install a specific Gitpod version |
| 50 | + |
| 51 | +You can install a specific Gitpod version by choosing the proper image tag. You'll find all image tags here: https://console.cloud.google.com/gcr/images/gitpod-core-dev/EU/build/gitpod-k3s |
| 52 | + |
| 53 | + |
| 54 | +## Persistent volumes |
| 55 | + |
| 56 | +The Gitpod Docker image stores its state in the following volumes: |
| 57 | + |
| 58 | +- `/var/gitpod/docker` |
| 59 | +- `/var/gitpod/docker-registry` |
| 60 | +- `/var/gitpod/minio` |
| 61 | +- `/var/gitpod/mysql` |
| 62 | +- `/var/gitpod/workspaces` |
| 63 | + |
| 64 | + |
| 65 | +## Troubleshooting |
| 66 | + |
| 67 | +In the Gitpod Docker container runs a k3s Kubernetes cluster. You can access `kubectl` by running `docker exec` like this (change the Docker container name `gitpod` accordingly): |
| 68 | +``` |
| 69 | +$ docker exec gitpod kubectl get pods |
| 70 | +``` |
| 71 | + |
| 72 | +Gitpod will be installed in the Kubernetes cluster by the pod `gitpod-helm-installer` in the `default` namespace. That means, shortly after starting the Gitpod Docker container, you should see this pod running: |
| 73 | +``` |
| 74 | +$ docker exec gitpod kubectl get pods |
| 75 | +NAME READY STATUS RESTARTS AGE |
| 76 | +gitpod-helm-installer 1/1 Running 0 2m11s |
| 77 | +``` |
| 78 | + |
| 79 | +The installation takes some time but finally you should see something like this: |
| 80 | +``` |
| 81 | +$ docker exec gitpod kubectl get pods |
| 82 | +NAME READY STATUS RESTARTS AGE |
| 83 | +registry-facade-7c77849c94-mdfp8 1/1 Running 0 3m24s |
| 84 | +ws-scheduler-678fb494db-x62tp 1/1 Running 0 3m23s |
| 85 | +svclb-proxy-bvs7g 2/2 Running 0 3m23s |
| 86 | +registry-548ddd9768-556bl 1/1 Running 0 3m24s |
| 87 | +ws-manager-node-wghz7 1/1 Running 0 3m23s |
| 88 | +minio-6845c586dc-ttvch 1/1 Running 0 3m24s |
| 89 | +ws-sync-jv7rn 1/1 Running 0 3m23s |
| 90 | +ws-manager-65df9b849d-trkkc 1/1 Running 0 3m23s |
| 91 | +image-builder-84585fb6d4-m4l66 2/2 Running 0 3m24s |
| 92 | +ws-proxy-554857b847-bptv2 1/1 Running 0 3m23s |
| 93 | +dashboard-9dd56dd95-svrr9 1/1 Running 0 3m24s |
| 94 | +proxy-7fcf5cf84f-8xgmf 1/1 Running 0 3m24s |
| 95 | +messagebus-7c59bc5c48-p5r4l 1/1 Running 0 3m24s |
| 96 | +theia-server-6fd46f8cb7-dz4kh 1/1 Running 0 3m24s |
| 97 | +mysql-65c5b9f8f9-x92b5 1/1 Running 0 3m24s |
| 98 | +node-daemon-gdpwk 1/1 Running 0 3m23s |
| 99 | +gitpod-helm-installer 0/1 Completed 0 4m12s |
| 100 | +ws-manager-bridge-b64c9f95f-5f8tf 1/1 Running 0 3m24s |
| 101 | +server-7f8454c5c5-pndst 1/1 Running 0 3m24s |
| 102 | +``` |
| 103 | +The `gitpod-helm-installer` pod is completed and all other pods are running. |
| 104 | + |
| 105 | +If a pod is crashing these commands may be helpful (change the pod name accordingly): |
| 106 | +```bash |
| 107 | +# describe a pod: |
| 108 | +docker exec gitpod kubectl describe pod server-7f8454c5c5-pndst |
| 109 | + |
| 110 | +# get the logs of a pod: |
| 111 | +docker exec gitpod kubectl logs server-7f8454c5c5-pndst |
| 112 | +``` |
0 commit comments