/docker-codeserver

Primary LanguageDockerfileGNU General Public License v3.0GPL-3.0

docker-codeserver

docker codeserver with docker-cli and vim

credits

  • linuxserver.io

Application Setup

Access the webui at http://<your-ip>:8443. For github integration, drop your ssh key in to /config/.ssh.

Setup differences with basic linuxserver/code-server image

  • use PGID & PUID 0
  • map volume /var/run/docker.sock:/var/run/docker.sock
  • map your dockerfiles as a volume
git config --global user.name "username"
git config --global user.email "email address"

Hashed code-server password

How to create the hashed password.

Usage

Here are some example snippets to help you get started creating a container.

docker-compose (recommended, click here for more info)

---
version: "2.1"
services:
  code-server:
    image: lscr.io/linuxserver/code-server:latest
    container_name: code-server
    environment:
      - PUID=0
      - PGID=0
      - TZ=Etc/UTC
      - PASSWORD=password #optional
      - HASHED_PASSWORD= #optional
      - SUDO_PASSWORD=password #optional
      - SUDO_PASSWORD_HASH= #optional
      - PROXY_DOMAIN=code-server.my.domain #optional
      - DEFAULT_WORKSPACE=/config/workspace #optional
    volumes:
      - /path/to/appdata/config:/config
      - /path/to/workspace:/workspace
      - /path/to/dockerfiles:/workspace/docker
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - 8443:8443
    restart: unless-stopped
docker run -d \
  --name=code-server \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Etc/UTC \
  -e PASSWORD=password `#optional` \
  -e HASHED_PASSWORD= `#optional` \
  -e SUDO_PASSWORD=password `#optional` \
  -e SUDO_PASSWORD_HASH= `#optional` \
  -e PROXY_DOMAIN=code-server.my.domain `#optional` \
  -e DEFAULT_WORKSPACE=/config/workspace `#optional` \
  -p 8443:8443 \
  -v /path/to/appdata/config:/config \
  --restart unless-stopped \
  lscr.io/linuxserver/code-server:latest

Parameters

Container images are configured using parameters passed at runtime (such as those above). These parameters are separated by a colon and indicate <external>:<internal> respectively. For example, -p 8080:80 would expose port 80 from inside the container to be accessible from the host's IP on port 8080 outside the container.

Parameter Function
-p 8443 web gui
-e PUID=1000 for UserID - see below for explanation
-e PGID=1000 for GroupID - see below for explanation
-e TZ=Etc/UTC specify a timezone to use, see this list.
-e PASSWORD=password Optional web gui password, if PASSWORD or HASHED_PASSWORD is not provided, there will be no auth.
-e HASHED_PASSWORD= Optional web gui password, overrides PASSWORD, instructions on how to create it is below.
-e SUDO_PASSWORD=password If this optional variable is set, user will have sudo access in the code-server terminal with the specified password.
-e SUDO_PASSWORD_HASH= Optionally set sudo password via hash (takes priority over SUDO_PASSWORD var). Format is $type$salt$hashed.
-e PROXY_DOMAIN=code-server.my.domain If this optional variable is set, this domain will be proxied for subdomain proxying. See Documentation
-e DEFAULT_WORKSPACE=/config/workspace If this optional variable is set, code-server will open this directory by default
-v /config Contains all relevant configuration files.