How to set up VSCode remote server connect with browser with Docker
If you want to code anywhere, with vscode codespace, you can. and if you want to host your own vscode on remote server, this is for you. it is easy to set up with docker.
In your linux, create a new bash script file name:
run_code_server.sh
.copy and paste below code snipper into
run_code_server.sh
save script
run script (make sure you have docker installed.)
./run_code_server.sh ~/.code-server/config ~/Project password password
now check whether docker container is up.
docker ps -a
You will see container name: code-server
up and running with port: 8443
now you can access vscode in your browser
http://<your-server-ip>:8443
ie. http://127.0.0.1:8443
Docker basic tips
docker ps -a
-- check all your docker containersdocker container ls
-- list all running containersdocker container stop <container-name/container-id>
ie.docker container stop code-server
-- stop containerdocker rm <container-name>
-- remove docker container
Common issues when run bash script
If you don't have Docker installed, install docker here
If you run into bash script permission denied on Linux, run below command
chmod +x <your bash script>
For example, code server script:
chmod +x ./run-code-server.sh
If you see below errors
Solution is to run sudo chmod 666 /var/run/docker.sock
For more details refer to offical Docker docs here
Last updated