Custom images allow you to define workspaces that include the dependencies, scripts, and user preferences helpful for your project.

This guide assumes that you're familiar with:

Resources

For ideas on what you can include in your images, see:

Creating a custom image

Instead of starting from scratch, we recommend extending one of our sample images:

# Dockerfile
FROM codercom/enterprise-base:ubuntu

USER root

# Add software, files, dev tools, and dependencies here
RUN apt-get install -y ...
COPY file ./

USER coder

...

Please note:

  • Coder workspaces mount a home volume. Any files in the image's home directory will be replaced by this persistent volume. If you have install scripts (e.g., those for Rust), you must configure them to install software in another directory.

  • If you're using a different base image, see our image minimum requirements to make sure that your image will work with all of Coder's features.

  • You can build images inside a CVM-enabled Coder workspace with Docker installed (see our base image for an example of how you can do this).

  • If you're using CVM-only features during an image's build time (e.g., you're pre-loading images in workspaces), you may need to install the sysbox runtime onto your local machine and build your images locally. Note that this isn't usually necessary, even if your image installs and enables Docker.

Example: Installing an IntelliJ IDE

This snippet shows you how to install an IntelliJ IDE onto your image so that you can use it in your Coder workspace:

# Dockerfile
FROM ...

# Install IDEs as root
USER root

RUN mkdir -p /opt/[IDE]
RUN curl -L \
"https://download.jetbrains.com/product?code=[CODE]&latest&distribution=linux" \
| tar -C /opt/[IDE] --strip-components 1 -xzvf
RUN ln -s /opt/[IDE]/bin/clion.sh /usr/bin/[IDE]

Make sure that you replace [IDE] with the name of the IDE in lowercase and provide its corresponding [CODE].

More specifically, here's how to install the CLion IDE onto your image:

# Dockerfile
FROM ...

USER root

# Install CLion
RUN mkdir -p /opt/clion
RUN curl -L \
"https://download.jetbrains.com/product?code=CL&latest&distribution=linux" \
| tar -C /opt/clion --strip-components 1 -xzvf
RUN ln -s /opt/clion/bin/clion.sh /usr/bin/clion
See an opportunity to improve our docs? Make an edit.