FAQ
- Questions?
- How should I expose code-server to the internet?
- Can I use code-server on the iPad?
- How does the config file work?
- How do I make my keyboard shortcuts work?
- Why can't code-server use Microsoft's extension marketplace?
- How can I request an extension that's missing from the marketplace?
- How do I install an extension?
- How do I install an extension manually?
- How do I use my own extensions marketplace?
- Where are extensions stored?
- Where is VS Code configuration stored?
- How can I reuse my VS Code configuration?
- How does code-server decide what workspace or folder to open?
- How do I access my Documents/Downloads/Desktop folders in code-server on macOS?
- How do I direct server-side requests through a proxy?
- How do I debug issues with code-server?
- What is the healthz endpoint?
- What is the heartbeat file?
- How do I change the password?
- Can I store my password hashed?
- Is multi-tenancy possible?
- Can I use Docker in a code-server container?
- How do I disable telemetry?
- What's the difference between code-server and Coder?
- What's the difference between code-server and Theia?
- What's the difference between code-server and OpenVSCode-Server?
- What's the difference between code-server and GitHub Codespaces?
- Does code-server have any security login validation?
- Are there community projects involving code-server?
- How do I change the port?
- How do I hide the coder/coder promotion in Help: Getting Started?
- How do I disable the proxy?
- How do I disable file download?
- Why do web views not work?
Questions?
Please file all questions and support requests athttps://github.com/coder/code-server/discussions.
How should I expose code-server to the internet?
Please seeour instructions on exposing code-server safely to theinternet.
Can I use code-server on the iPad?
SeeiPad for information on using code-server on the iPad.
How does the config file work?
Whencode-server
starts up, it creates a default config file in~/.config/code-server/config.yaml
:
bind-addr: 127.0.0.1:8080auth: passwordpassword: mew...22 # Randomly generated for each config.yamlcert: false
The default config defines the following behavior:
- Listen on the loopback IP port 8080
- Enable password authorization
- Do not use TLS
Each key in the file maps directly to acode-server
flag (runcode-server --help
to see a listing of all the flags). Any flags passed tocode-server
will take priority over the config file.
You can change the config file's location using the--config
flag or$CODE_SERVER_CONFIG
environment variable.
The default location respects$XDG_CONFIG_HOME
.
How do I make my keyboard shortcuts work?
Many shortcuts will not work by default, since they'll be "caught" by the browser.
If you use Chrome, you can work around this by installing the progressive webapp (PWA):
- Start the editor
- Click theplus icon in the URL toolbar to install the PWA
If you use Firefox, you can use the appropriate extension to install PWA.
- Go to the installationwebsite of the add-on
- Add the add-on to Firefox
- Follow the os-specific instructions on how to install the runtime counterpart
For other browsers, you'll have to remap keybindings for shortcuts to work.
Why can't code-server use Microsoft's extension marketplace?
Though code-server takes the open-source core of VS Code and allows you to runit in the browser, it is not entirely equivalent to Microsoft's VS Code.
One major difference is in regards to extensions and the marketplace. The coreof VS code is open source, while the marketplace and many published Microsoftextensions are not. Furthermore, Microsoft prohibits the use of anynon-Microsoft VS Code from accessing their marketplace. Per theTerms ofService:
Marketplace Offerings are intended for use only with Visual Studio Productsand Services, and you may only install and use Marketplace Offerings withVisual Studio Products and Services.
Because of this, we can't offer any extensions on Microsoft's marketplace.Instead, we use theOpen-VSX extension gallery, which is also used by various other forks.It isn't perfect, but its getting better by the day with more and more extensions.
We also offer our own marketplace for open source extensions, but plan todeprecate it at a future date and completely migrate to Open-VSX.
These are the closed-source extensions that are presently unavailable:
- Live Share. We mayimplement something similar (see#33)
- Remote Extensions (SSH, Containers,WSL). We may implementthese again at some point, see(#1315).
For more about the closed source portions of VS Code, seevscodium/vscodium.
How can I request an extension that's missing from the marketplace?
To add an extension to Open-VSX, please seeopen-vsx/publish-extensions.We no longer plan to add new extensions to our legacy extension gallery.
How do I install an extension?
You can install extensions from the marketplace using the extensions sidebar incode-server or from the command line:
code-server --install-extension <extension id># example: code-server --install-extension wesbos.theme-cobalt2# From the Coder extension marketplacecode-server --install-extension ms-python.python# From a downloaded VSIX on the file systemcode-server --install-extension downloaded-ms-python.python.vsix
How do I install an extension manually?
If there's an extension unavailable in the marketplace or an extension thatdoesn't work, you can download the VSIX from its GitHub releases or build ityourself.
Once you have downloaded the VSIX to the remote machine, you can either:
- Run theExtensions: Install from VSIX command in the Command Palette.
- Run
code-server --install-extension <path to vsix>
in the terminal
You can also download extensions using the command line. For instance,downloading from OpenVSX can be done like this:
code-server --install-extension <extension id>
How do I use my own extensions marketplace?
If you own a marketplace that implements the VS Code Extension Gallery API, youcan point code-server to it by setting$EXTENSIONS_GALLERY
.This corresponds directly with theextensionsGallery
entry in in VS Code'sproduct.json
.
For example:
export EXTENSIONS_GALLERY='{"serviceUrl": "https://my-extensions/api"}'
Though you can technically use Microsoft's marketplace in this manner, westrongly discourage you from doing so since this isagainst their Terms of Use.
For further information, seethisdiscussionregarding the use of the Microsoft URLs in forks, as well asVSCodium'sdocs.
Where are extensions stored?
Extensions are stored in~/.local/share/code-server/extensions
by default.
On Linux and macOS if you set theXDG_DATA_HOME
environment variable, theextensions directory will be$XDG_DATA_HOME/code-server/extensions
. Ingeneral, we try to follow the XDG directory spec.
Where is VS Code configuration stored?
VS Code configuration such as settings and keybindings are stored in~/.local/share/code-server
by default.
On Linux and macOS if you set theXDG_DATA_HOME
environment variable, the datadirectory will be$XDG_DATA_HOME/code-server
. In general, we try to follow theXDG directory spec.
How can I reuse my VS Code configuration?
You can use theSettingsSyncextension for this purpose.
Alternatively, you can also pass--user-data-dir ~/.vscode
or copy~/.vscode
into~/.local/share/code-server
to reuse your existing VS Code extensions andconfiguration.
How does code-server decide what workspace or folder to open?
code-server tries the following in this order:
- The
workspace
query parameter - The
folder
query parameter - The workspace or directory passed via the command line
- The last opened workspace or directory
How do I access my Documents/Downloads/Desktop folders in code-server on macOS?
Newer versions of macOS require permission through a non-UNIX mechanism forcode-server to access the Desktop, Documents, Pictures, Downloads, and other folders.
You may have to give Node.js full disk access, since it doesn't implement any of the macOS permission request features natively:
Find where Node.js is installed on your machine
$ which node/usr/local/bin/node
Grant Node.js full disk access. OpenSystem Preferences >Security &Privacy >Privacy >Full Disk Access. Then, click the 🔒 to unlock,click+, and select the Node.js binary you located in the previous step.
See#2794 for additional context.
How do I direct server-side requests through a proxy?
code-server proxies only server-side requests.
To direct server-side requests through a proxy, code-server supports thefollowing environment variables:
$HTTP_PROXY
$HTTPS_PROXY
$NO_PROXY
export HTTP_PROXY=https://134.8.5.4export HTTPS_PROXY=https://134.8.5.4# Now all of code-server's server side requests will go through# https://134.8.5.4 first.code-server
- Seeproxy-from-envfor a detailed reference on these environment variables and their syntax (notethat code-server only uses the
http
andhttps
protocols). - Seeproxy-agent for informationon on the supported proxy protocols.
How do I debug issues with code-server?
First, run code-server with thedebug
logging (ortrace
to be reallythorough) by setting the--log
flag or theLOG_LEVEL
environment variable.-vvv
and--verbose
are aliases for--log trace
.
First, run code-server withdebug
logging (ortrace
logging for morethorough messages) by setting the--log
flag or theLOG_LEVEL
environmentvariable.
code-server --log debug
Note that the
-vvv
and--verbose
flags are aliases for--log trace
.
Next, replicate the issue you're having so that you can collect logginginformation from the following places:
- The most recent files from
~/.local/share/code-server/coder-logs
- The browser console
- The browser network tab
Additionally, collecting core dumps (you may need to enable them first) ifcode-server crashes can be helpful.
What is the healthz endpoint?
You can use the/healthz
endpoint exposed by code-server to check whethercode-server is running without triggering a heartbeat. The response includes astatus (e.g.,alive
orexpired
) and a timestamp for the last heartbeat(the default is0
).
{ "status": "alive", "lastHeartbeat": 1599166210566}
This endpoint doesn't require authentication.
What is the heartbeat file?
As long as there is an active browser connection, code-server touches~/.local/share/code-server/heartbeat
once a minute.
If you want to shutdown code-server if there hasn't been an active connectionafter a predetermined amount of time, you can do so by checking continuously forthe last modified time on the heartbeat file. If it is older than X minutes (orwhatever amount of time you'd like), you can kill code-server.
Eventually,#1636 will makethis process better.
How do I change the password?
Edit thepassword
field in the code-server config file at~/.config/code-server/config.yaml
, then restart code-server:
sudo systemctl restart code-server@$USER
Can I store my password hashed?
Yes, you can do so by setting the value ofhashed-password
instead ofpassword
. Generate the hash with:
echo -n "thisismypassword" | npx argon2-cli -e$argon2i$v=19$m=4096,t=3,p=1$wst5qhbgk2lu1ih4dmuxvg$ls1alrvdiwtvzhwnzcm1dugg+5dto3dt1d5v9xtlws4
Replacethisismypassword
with your actual password andremember to put itinside quotes! For example:
auth: passwordhashed-password: "$argon2i$v=19$m=4096,t=3,p=1$wST5QhBgk2lu1ih4DMuxvg$LS1alrVdIWtvZHwnzCM1DUGg+5DTO3Dt1d5v9XtLws4"
Thehashed-password
field takes precedence overpassword
.
If you're using Docker Compose file, in order to make this work, you need to change all the single $ to $$. For example:
- HASHED_PASSWORD=$$argon2i$$v=19$$m=4096,t=3,p=1$$wST5QhBgk2lu1ih4DMuxvg$$LS1alrVdIWtvZHwnzCM1DUGg+5DTO3Dt1d5v9XtLws4
Is multi-tenancy possible?
If you want to run multiple code-servers on shared infrastructure, we recommendusing virtual machines (provide one VM per user). This will easily allow usersto run a Docker daemon. If you want to use Kubernetes, you'll want tousekubevirt orsysbox to give each user a VM-likeexperience instead of just a container.
Can I use Docker in a code-server container?
If you'd like to access Docker inside of code-server, mount the Docker socket infrom/var/run/docker.sock
. Then, install the Docker CLI in the code-servercontainer, and you should be able to access the daemon.
You can even make volume mounts work. Let's say you want to run a container andmount into/home/coder/myproject
from inside thecode-server
container. Youneed to make sure the Docker daemon's/home/coder/myproject
is the same as theone mounted inside thecode-server
container, and the mount will work.
If you want Docker enabled when deploying on Kubernetes, look at thevalues.yaml
file for the 3 fields:extraVars
,lifecycle.postStart
, andextraContainers
.
How do I disable telemetry?
Use the--disable-telemetry
flag to disable telemetry.
We use the data collected only to improve code-server.
What's the difference between code-server and Coder?
code-server and Coder are both applications that can be installed on anymachine. The main difference is who they serve. Out of the box, code-server issimply VS Code in the browser while Coder is a tool for provisioning remotedevelopment environments via Terraform.
code-server was built for individuals while Coder was built for teams. In Coder, you create Workspaces which can have applications like code-server. If you're looking for a team solution, you should reach forCoder.
What's the difference between code-server and Theia?
At a high level, code-server is a patched fork of VS Code that runs in thebrowser whereas Theia takes some parts of VS Code but is an entirely differenteditor.
Theia is a browser IDE loosely basedon VS Code. It uses the same text editor library(Monaco) and extension API, buteverything else is different. Theia also usesOpen VSXfor extensions.
Theia doesn't allow you to reuse your existing VS Code config.
What's the difference between code-server and OpenVSCode-Server?
code-server and OpenVSCode-Server both allow you to access VS Code via abrowser. OpenVSCode-Server is a direct fork of VS Code with changes comitteddirectly while code-server pulls VS Code in via a submodule and makes changesvia patch files.
However, OpenVSCode-Server is scoped at only making VS Code available as-is inthe web browser. code-server contains additional changes to make the self-hostedexperience better (see the next section for details).
What's the difference between code-server and GitHub Codespaces?
Both code-server and GitHub Codespaces allow you to access VS Code via abrowser. GitHub Codespaces, however, is a closed-source, paid service offered byGitHub and Microsoft.
On the other hand, code-server is self-hosted, free, open-source, and can be runon any machine with few limitations.
Specific changes include:
- Password authentication
- The ability to host at sub-paths
- Self-contained web views that do not call out to Microsoft's servers
- The ability to use your own marketplace and collect your own telemetry
- Built-in proxy for accessing ports on the remote machine integrated intoVS Code's ports panel
- Wrapper process that spawns VS Code on-demand and has a separate CLI
- Notification when updates are available
- Some other things
Some of these changes appear very unlikely to ever be adopted by Microsoft.Some may make their way upstream, further closing the gap, but at the moment itlooks like there will always be some subtle differences.
Does code-server have any security login validation?
code-server supports setting a single password and limits logins to two perminute plus an additional twelve per hour.
Are there community projects involving code-server?
Visit theawesome-code-serverrepository to view community projects and guides with code-server! Feel free toadd your own!
How do I change the port?
There are two ways to change the port on which code-server runs:
- with an environment variable e.g.
PORT=3000 code-server
- using the flag
--bind-addr
e.g.code-server --bind-addr localhost:3000
How do I hide the coder/coder promotion in Help: Getting Started?
You can pass the flag--disable-getting-started-override
tocode-server
oryou can set the environment variableCS_DISABLE_GETTING_STARTED_OVERRIDE=1
orCS_DISABLE_GETTING_STARTED_OVERRIDE=true
.
How do I disable the proxy?
You can pass the flag--disable-proxy
tocode-server
oryou can set the environment variableCS_DISABLE_PROXY=1
orCS_DISABLE_PROXY=true
.
Note, this option currently only disables the proxy routes to forwarded ports, includingthe domain and path proxy routes over HTTP and WebSocket; however, it does notdisable the automatic port forwarding in the VS Code workbench itself. In other words,user will still see the Ports tab and notifications, but will not be able to actuallyuse access the ports. It is recommended to setremote.autoForwardPorts
tofalse
when using the option.
How do I disable file download?
You can pass the flag--disable-file-downloads
tocode-server
Why do web views not work?
Web views rely on service workers, and service workers are only available in asecure context, so most likely the answer is that you are using an insecurecontext (for example an IP address).
If this happens, in the browser log you will see something like:
Error loading webview: Error: Could not register service workers: SecurityError: Failed to register a ServiceWorker for scope with script: An SSL certificate error occurred when fetching the script..
To fix this, you must either:
- Access over localhost/127.0.0.1 which is always considered secure.
- Use a domain with a real certificate (for example with Let's Encrypt).
- Use a trusted self-signed certificate withmkcert (orcreate and trust a certificate manually).
- Disable security if your browser allows it. For example, in Chromium see
chrome://flags/#unsafely-treat-insecure-origin-as-secure