Microsoft Visual Studio Code inside a container
6.3K
This project provides a containerized VSCode server environment, allowing you to run VSCode in a web browser. It's designed to be secure, customizable, and easy to set up.
Clone this repository:
git clone https://github.com/MohamedElashri/vscode-server-docker.git
cd vscode-server-docker
Copy the example sample.env file and modify it as needed:
cp sample.env .env
Edit the .env file and set the following required variables:
VSCODE_KEYRING_PASS=your_secure_password
CONNECTION_TOKEN=your_connection_token
Replace your_secure_password and your_connection_token with strong, unique values.
Build and start the container:
docker-compose up -d
Access VSCode in your web browser at http://localhost:8000/?tkn=YOUR_CONNECTION_TOKEN (replace YOUR_CONNECTION_TOKEN with the value you set in the .env file).
NOTE: This will not work if you are not using localhost or 127.0.0.1. According to this issue, The CLI does not support running serve-web with a TLS certificate, requiring an additional proxy layer like nginx. This is a limitation of browsers.
You can customize the setup by modifying the following variables in the .env file:
USER: The username for the VSCode user (default: vscode)USER_ID: The user ID for the VSCode user (default: 1000)GROUP_ID: The group ID for the VSCode user (default: 1000)WORKDIR: The name of the workspace directory (default: workspace)VSCODE_SERVE_MODE: The serve mode for VSCode (default: local)VSCODE_KEYRING_PASS: The password for the VSCode keyring (required, no default)VSCODE_SERVER_PORT: The port to access VSCode (default: 8000)CONNECTION_TOKEN: A secure token for authenticating access to the VSCode server (required, no default)TAG: The tag for the Docker image (default: latest)The Docker Compose configuration uses named volumes to persist data:
vscode_data: Stores VSCode settingsvscode_server_data: Stores VSCode server-specific dataworkdir_data: Stores your workspace filesdocker-compose up -d
docker-compose down
Pull the latest changes from the repository:
git pull origin main
Rebuild and restart the container:
docker-compose up -d --build
docker-compose logs
VSCODE_KEYRING_PASS and CONNECTION_TOKEN in the .env file..env file. Add it to your .gitignore to prevent accidental commits.VSCODE_KEYRING_PASS or CONNECTION_TOKEN are not set, ensuring these critical security measures are in place.VSCODE_KEYRING_PASS and CONNECTION_TOKEN in your .env file..env file is in the same directory as your docker-compose.yml file.Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Content type
Image
Digest
sha256:e0eaa2b0b…
Size
573.4 MB
Last updated
7 days ago
docker pull melashri/vscode-server