Skip to content

feat: add universal image #307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions images/universal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Example Universal Image

[![Docker Pulls](https://img.shields.io/docker/pulls/codercom/example-universal?label=codercom%2Fexample-universal)](https://hub.docker.com/r/codercom/example-universal)

## Description

Microsoft's [Universal Dev Container Image](https://github.com/devcontainers/images/tree/main/src/universal) extended with a `coder` user.
7 changes: 7 additions & 0 deletions images/universal/first-run-notice.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Welcome to Coder! This environment is based on Microsoft's Dev Container Universal image
with a suite of common tools and languages (Python, Java, Node.js, Go, Rust, etc.)

➡️ https://github.com/devcontainers/images/tree/main/src/universal

To use another image, modify your devcontainer.json or your Coder Template.

24 changes: 24 additions & 0 deletions images/universal/ubuntu.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM mcr.microsoft.com/devcontainers/universal:linux

USER root

COPY first-run-notice.txt /usr/local/etc/vscode-dev-containers/

# Remove Conda to avoid any license issues
RUN rm -R /opt/conda && \
rm /usr/local/etc/vscode-dev-containers/conda-notice.txt

# Install Chrome for AI Browser Testing
RUN yes | npx playwright install chrome

# Create `coder` user
RUN userdel -r codespace && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think deluser leaves the user's home directory.

You should use userdel --remove-all-files --remove-home

I am not sure how this will behave with all installed tools from the base image though.

Or better rename the user and move over the existing home directory

RUN usermod -l coder codespace \
 && usermod -d /home/coder -m coder \
 && groupmod -n coder codespace

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirmed userdel doesn't keep the home folder!

Screenshot 2025-08-19 at 4 11 30 PM

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will build and test before approving. Can do today.

useradd coder \
--create-home \
--shell=/bin/bash \
--groups=docker \
--uid=1000 \
--user-group && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers.d/nopasswd

USER coder
Loading