Skip to content

theohbrothers/docker-code-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-code-server

github-actions github-release docker-image-size

Dockerized code-server.

Tags

Tag Dockerfile Build Context
:4.18.0, :latest View
:4.18.0-docker View
:4.18.0-docker-go-1.20.10 View
:4.18.0-docker-rootless View
:4.18.0-docker-rootless-go-1.20.10 View
:4.17.1 View
:4.17.1-docker View
:4.17.1-docker-go-1.20.10 View
:4.17.1-docker-rootless View
:4.17.1-docker-rootless-go-1.20.10 View
:4.16.1 View
:4.16.1-docker View
:4.16.1-docker-go-1.20.10 View
:4.16.1-docker-rootless View
:4.16.1-docker-rootless-go-1.20.10 View
:4.15.0 View
:4.15.0-docker View
:4.15.0-docker-go-1.20.10 View
:4.15.0-docker-rootless View
:4.15.0-docker-rootless-go-1.20.10 View
:4.14.1 View
:4.14.1-docker View
:4.14.1-docker-go-1.20.10 View
:4.14.1-docker-rootless View
:4.14.1-docker-rootless-go-1.20.10 View
:4.13.0 View
:4.13.0-docker View
:4.13.0-docker-go-1.20.10 View
:4.13.0-docker-rootless View
:4.13.0-docker-rootless-go-1.20.10 View
:4.12.0 View
:4.12.0-docker View
:4.12.0-docker-go-1.20.10 View
:4.12.0-docker-rootless View
:4.12.0-docker-rootless-go-1.20.10 View
:4.11.0 View
:4.11.0-docker View
:4.11.0-docker-go-1.20.10 View
:4.11.0-docker-rootless View
:4.11.0-docker-rootless-go-1.20.10 View
:4.10.1 View
:4.10.1-docker View
:4.10.1-docker-go-1.20.10 View
:4.10.1-docker-rootless View
:4.10.1-docker-rootless-go-1.20.10 View
:4.9.1 View
:4.9.1-docker View
:4.9.1-docker-go-1.20.10 View
:4.9.1-docker-rootless View
:4.9.1-docker-rootless-go-1.20.10 View
:4.8.3 View
:4.8.3-docker View
:4.8.3-docker-go-1.20.10 View
:4.8.3-docker-rootless View
:4.8.3-docker-rootless-go-1.20.10 View
:4.7.1 View
:4.7.1-docker View
:4.7.1-docker-go-1.20.10 View
:4.7.1-docker-rootless View
:4.7.1-docker-rootless-go-1.20.10 View
:4.6.1 View
:4.6.1-docker View
:4.6.1-docker-go-1.20.10 View
:4.6.1-docker-rootless View
:4.6.1-docker-rootless-go-1.20.10 View

Base variants are based on alpine, and include npm 8 and nodejs 16 (to run code-server), pwsh, and basic tools. E.g. 4.18.0

Incremental variants include additional tools and their code extensions:

Usage

Base variant(s)

docker run --name code-server --rm -it -p 127.0.0.1:8080:8080 theohbrothers/docker-code-server:4.18.0
# code-server is now available at http://127.0.0.1:8080. To login, use the password in the config file: --bind-addr=0.0.0.0:8080 --auth=none --disable-telemetry --disable-update-check
docker exec code-server sh -c 'cat ~/.config/code-server/config.yaml'

To disable password authentication, use --auth=none:

docker run --name code-server --rm -it -p 127.0.0.1:8080:8080 theohbrothers/docker-code-server:4.18.0 --bind-addr=0.0.0.0:8080 --auth=none --disable-telemetry --disable-update-check

docker variant(s)

docker run --name code-server --rm -it --privileged -p 127.0.0.1:8080:8080 theohbrothers/docker-code-server:4.18.0-docker
# code-server is now available at http://127.0.0.1:8080. To login, use the password in the config file:
docker exec code-server sh -c 'cat ~/.config/code-server/config.yaml'

To disable password authentication, use --auth=none:

docker run --name code-server --rm -it -p 127.0.0.1:8080:8080 theohbrothers/docker-code-server:4.18.0-docker --bind-addr=0.0.0.0:8080 --auth=none --disable-telemetry --disable-update-check

docker buildx

To build multi-arch images using docker buildx, the host must have kernel >= 4.8, and must have setup qemu in the kernel (see here):

# This must be run on each reboot on the host to setup qemu
docker run --rm --privileged tonistiigi/binfmt:latest --install all

Then, buildx multi-arch builds are now available in the container:

# Create a builder and use it
docker buildx create --name mybuilder --driver docker-container
docker buildx use mybuilder
docker buildx ls # Should show several platforms
docker buildx inspect mybuilder # Should show several platforms

# Build
docker buildx build ...

docker-rootless variant(s)

docker run --name code-server --rm -it --privileged -p 127.0.0.1:8080:8080 theohbrothers/docker-code-server:4.18.0-docker-rootless
# code-server is now available at http://127.0.0.1:8080. To login, use the password in the config file:
docker exec code-server sh -c 'cat ~/.config/code-server/config.yaml'

To start code-server without password authentication, use --auth=none:

docker run --name code-server --rm -it -p 127.0.0.1:8080:8080 theohbrothers/docker-code-server:4.18.0-docker-rootless --bind-addr=0.0.0.0:8080 --auth=none --disable-telemetry --disable-update-check

To build multi-arch images using docker buildx, see here.

Notes

  • The default user is named user with UID 1000. To escalate as root, use sudo.
  • Users should provision their own configuration files at entrypoint. Examples include dotfiles such as ~/.bash_aliases, ~/.gitconfig, and code configs such as ~/.local/share/code-server/User/keybindings.json and ~/.local/share/code-server/User/settings.json. It is recommended to use any of these utilities for managing dotfiles.
  • To ensure bash-completion works, ensure /etc/profile.d/bash_completion.sh is sourced by ~/.bashrc. When execing into the container, use a login shell (E.g. docker exec -it <container> bash -l).
  • To install a custom version of a code extension, set "extensions.autoCheckUpdates": true in settings.json. Under Extensions view, click the extension's cogwheel and select Install Another Version....

Development

Requires Windows powershell or pwsh.

# Install Generate-DockerImageVariants module: https://github.com/theohbrothers/Generate-DockerImageVariants
Install-Module -Name Generate-DockerImageVariants -Repository PSGallery -Scope CurrentUser -Force -Verbose

# Edit ./generate templates

# Generate the variants
Generate-DockerImageVariants .

Variant versions

versions.json contains a list of Semver versions, one per line.

To update versions in versions.json:

./Update-Versions.ps1

To update versions in versions.json, and open a PR for each changed version, and merge successful PRs one after another (to prevent merge conflicts), and finally create a tagged release and close milestone:

$env:GITHUB_TOKEN = 'xxx'
./Update-Versions.ps1 -PR -AutoMergeQueue -AutoRelease

To perform a dry run, use -WhatIf.