Custom images allow you to define workspaces that include the dependencies, scripts, and user preferences helpful for your project.
If you're unfamiliar with how to create, build, and push Docker Images, please review this tutorial by Docker before proceeding.
Creating a custom image
Instead of starting from scratch, we recommend extending one of our sample images:
# Dockerfile
FROM codercom/enterprise-base:ubuntu
RUN apt-get install -y ...
COPY file ./
...
Please note:
-
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 Coder workspace using the Docker Sandbox. If, however, you're using CVMs, you'll need to have the sysbox runtime on your machine.
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
Sample images
To get an idea of what you can include in your images, see:
- Ben's Coder images (frequently referred to in Coffee and Coder and the Coder blog)
- Sample Coder images