
code-server enables you to run VS Code on a remote server and access it through a web browser from anywhere. code-server, the open-source implementation, offers the full VS Code experience, including extensions, an integrated terminal, Git integration, and IntelliSense support through a browser interface.
This article shows how to deploy code-server on Ubuntu 24.04 with Docker Compose and secure it using HTTPS with a Traefik reverse proxy.
Before you begin:
code.example.com.This section deploys code-server using a Docker Compose configuration that defines two services: a code-server container that provides the browser-based VS Code environment, and a Traefik container that acts as the reverse proxy. Traefik automatically provisions HTTPS certificates with Let’s Encrypt and routes incoming traffic to the code-server service.
Create project directories.
The project subdirectory stores your editable workspace files, config stores code-server settings and extensions, local holds user-specific data, and letsencrypt stores Traefik's ACME certificates for TLS management.
Navigate to the project's root directory.
Find the UID and GID of your user account.
From the output, note the uid and gid of the user account.
Add your user to the Docker group to run Docker commands without sudo.
Create and edit a Docker Compose manifest file.
Add the Following contents to the file.
Replace the following placeholder in the above manifest:
UID:GID with the UID and GID from step 3.SECURE_PASSWORD with a strong password.CODE.EXAMPLE.COM with your domain.ADMIN@EXAMPLE.COM with your email for Let's Encrypt notifications.LINUXUSER with your username.Save and close the file. This Docker Compose file deploys code-server behind Traefik, which provides automatic HTTPS using Let’s Encrypt. Here’s what each part does:
code-server service
codercom/code-server image.CODE.EXAMPLE.COM) to the code-server container over HTTPS.traefik service
./letsencrypt directory.internal network
Start the services.
Verify the service's status.
For more information on managing a Docker Compose stack, see the How To Use Docker Compose article.
Access and verify your code-server installation.
https://CODE.EXAMPLE.COM in a browser.You should see the code-server home page.
By following this article, you successfully deployed code-server on Ubuntu 24.04 using Docker Compose and secured it with Traefik, providing a powerful cloud-based development environment accessible from any browser. For more information, refer to the code-server Documentation.
0 Comments
Be the first to comment and share your perspective with the community.