Learn how to use different workspaces images available in Gitpod. The workspace image defines the base environment from which your workspaces are created. Or, you can create and use your own custom workspace images.
Workspace-Full
as the foundation for workspaces. Workspaces started based on this default image come pre-installed with Docker, Nix, Go, Java, Node.js, C/C++, Python, Ruby, Rust, Clojure as well as tools such as Homebrew, Tailscale, Nginx and several more.
If this image does not include the tools you need for your project, you can provide a public Docker image or your own Dockerfile. This provides you with the flexibility to install the tools & libraries required for your project.
.gitpod.yml
file with the following configuration:
image: node:buster
if you are interested in a particular version of the Docker image.
For Gitpod images, we recommend using timestamped tag for maximum reproducibility, for example image: gitpod/workspace-full:2022-05-08-14-31-53
(taken from the Tags
panel on this dockerhub page for example)
GITPOD_IMAGE_AUTH
environment variable, which accepts the format <registry-domain>:<base64-encoded 'username:password'>
. Credentials for different registries can be appended, separated by commas.
This environment variable can be configured on either organization, project or user-level.
GITPOD_IMAGE_AUTH
, use this script:
docker.io
), the username foo
and the password bar
, which results in: docker.io:Z2VybzpiYXI=
Docker Hub (or any other registry)
GITPOD_IMAGE_AUTH
with the generated value to your repositories environment variables or Organization settingsAWS ECR (Gitpod Enterprise only)
Google Artifact Registry
GITPOD_IMAGE_AUTH
with the generated value to your repositories environment variables or Organization settingsGITPOD_IMAGE_AUTH
is not mounted into workspaces for security reasons. If you need Docker access within your workspace (e.g., for docker pull
/docker push
or gp validate
workflow), enable dockerd
authentication in Repository configuration.
docker.io
- or drop it entirely, to make use of the library
syntax: e.g. bash:latest
or just python
.gitpod.yml
file:
.gitpod.Dockerfile
file at the root of your project. The syntax is the regular Dockerfile
syntax as documented on docs.docker.com.
A good starting point for creating a custom .gitpod.Dockerfile
is the gitpod/workspace-full image as it already contains all the tools necessary to work with all languages
Gitpod supports.
COPY
instructions in a Dockerfile is only evaluated once and then
cached.gitpod/workspace-full
image, you get Docker support built-in to your environment.
If you want a base image without the default tooling installed then use the gitpod/workspace-base image.
gitpod
user, so all local settings, config file, etc. should apply to /home/gitpod
or be run using USER gitpod
(we no longer recommend using USER root
).
You can however use sudo
in your Dockerfile. The following example shows a typical .gitpod.Dockerfile
inheriting from gitpod/workspace-full
:
For example, you can copy your repository inside the image and execute a script:
If you want to access Gitpod environment variables when building images using the Docker daemon running in your workspace. Here’s what you could do:
- Prepare a custom dockerfile (
.gitpod.Dockerfile
), example contents:
- Build an image using the Docker daemon running in your workspace like so:
docker build --build-arg DOWNLOAD_URL -f .gitpod.Dockerfile .
- Push the image to your dockerhub account and change it’s visibility to private.
- Use the image from your
.gitpod.yml
:
- Setup private docker image support on Gitpod to use it.
/workspace
directory mount
/ide
layer
gitpod
user with the right UID, and install git
to ensure your workspace can start. See the below Dockerfiles as a reference.
docker
and docker-compose
.
Tailscale: see the Tailscale integration docs for setting up Tailscale in a custom Dockerfile.
gp validate
command from within the workspace with your configuration changes. For the configuration change to apply for all new workspaces you must commit and push your configuration to source control.
For a full guide, see Configuring Workspaces.
https://gitpod.io/#imagebuild/<your-repo-url>
.
Feedback needed: Custom shell support is in the works. The below shows a method for running some of the ~/.bashrc.d
startup scripts. To leave feedback on the approach, please see this GitHub issue: #10105.
For example, if you wish to default your workspace-image to zsh
, you could do it from your custom dockerfile with the following line:
SHELL
with */*
scope for setting a personal default SHELL.
Caveat: Shells like fish
, zsh
and etc. are not POSIX-compliant or bash-compatible, so your Gitpod tasks might error if you use some POSIX or bash specific features in your task scripts.
~/.bashrc.d
, that means if you change your SHELL from bash
to something else, they will not auto run. You could run the following command from your SHELL to workaround:
/etc/bash.bashrc
before ~/.bashrc
for interactive non-login shells, so this configuration is usually applied system-wide from one of the initialization processes.
You can read more about this here.
.gitpod.Dockerfile
looks like the following:
gitpod/workspace-full
.
And then your .gitpod.Dockerfile
could look like:
xdg-open
command not foundgitpod/workspace-full-vnc
docker image. See this page for more info.