JetBrains CodeCanvas 2024.1 Help

Container Image

Dev environments in CodeCanvas run in Docker containers. The toolchains, runtimes, and other software required for development are defined in a Docker image. When creating a template, you can either use a default image provided by CodeCanvas or specify a custom one.

Default Docker image

If you don't specify a Docker image, CodeCanvas will use the default one. The default image is based on Ubuntu OS and includes Git, curl, Docker, Docker Compose, Kubernetes, Google Cloud support, Open JDK, Python, PHP, .NET SDK, Ruby, Go, Node.js, npm, yarn, and other tools.

You can find the default image in the public JetBrains Docker registry: public.jetbrains.space/p/codecanvas/packages/container/releases/dev-container-default:2024.1

You can use the default image's Dockerfile as a basis for creating your own image.

Use custom Docker image

Image requirements
  • OS: any Linux distribution that includes GLIBC 2.27 or later. For example, CentOS 7+, Debian 9+, Ubuntu 20.04+.

  • Tools: Git, OpenSSH, util-linux, Docker.

  • Your base Docker image must adhere to the Filesystem Hierarchy Standard (FHS).

  • The container must run as root (there must be no non-root users in Dockerfile).

The minimal viable Dockerfile:

FROM ubuntu:latest # Install necessary tools RUN apt-get update && apt-get install -y \ openssh-server \ util-linux \ git \ docker.io

To specify the URL of your custom image, use the Advanced | Dev container image section of a dev environment template.

Container image

You can use any image from any private or public registry, including Docker Hub, GitHub Container Registry, and others.

  • Docker Hub

    If you host your image on Docker Hub, you can specify only the image name. For example, mycompany/myimage:latest

  • Other registries

    If you use a registry different from Docker Hub, specify the full URL of the image. For example, registry.example.com/mycompany/myimage:latest

Private registries

If your registry requires authentication, add a connection to this registry in the namespace settings.

To connect a Docker registry

  1. Find the namespace.

  2. On the sidebar namespace menu, click Settings, then select Docker Registry Connections.

  3. Click New connection and specify connection settings:

    • Key: a unique connection name that you will use to reference this connection in jobs, e.g., docker_hub or some_registry

    • Docker registry server: a URL of the remote Docker registry. For Docker Hub, it's index.docker.io

    • Username and Password: the username and the password (token) created previously.

Container image vs. warm-up snapshot

Sometimes, you might face a dilemma about where to put a particular preparation step: to the container image or to the environment warm-up. For example, your project requires an SDK. To get the SDK, you run curl - o sdk.zip $SDK_URL && unzip sdk.zip. Where do you put this line: to the Dockerfile or to the warm-up script?

Our recommendations:

  • All additional tools (e.g., the tools installed with apt get) should be installed to the dev environment's image, i.e., described in the Dockerfile.

  • All binary dependencies stored within the root or the project directory should go to a warm-up script. So, in the example above, the best solution would be to get the SDK in a warm-up script.

Last modified: 17 May 2024