1
2
3
4
5
6
7
8
9
10
docker run -it --name code-server \
--restart=always \
-p 8082:8080 \
-v "/home/fmq/program/vscode_web/local:/home/coder/.local" \
-v "/home/fmq/program/vscode_web/config:/home/coder/.config" \
-v "/home/fmq/workspace:/home/coder/project" \
-u "$(id -u):$(id -g)" \
-e "DOCKER_USER=fmq" \
-e "PASSWORD=fmq_ubuntu_code" \
codercom/code-server:latest

https://coder.com/docs/code-server/

https://github.com/coder/code-server

修改 deb 源

1
sudo vi /etc/apt/sources.list.d/debian.sources

将清华源添加到文件中

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Types: deb
URIs: https://mirrors.tuna.tsinghua.edu.cn/debian
Suites: bookworm bookworm-updates bookworm-backports
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
# Types: deb-src
# URIs: https://mirrors.tuna.tsinghua.edu.cn/debian
# Suites: bookworm bookworm-updates bookworm-backports
# Components: main contrib non-free non-free-firmware
# Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
Types: deb
URIs: https://security.debian.org/debian-security
Suites: bookworm-security
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

# Types: deb-src
# URIs: https://security.debian.org/debian-security
# Suites: bookworm-security
# Components: main contrib non-free non-free-firmware
# Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

code-server 的扩展商店里扩展较少,可以添加 vscode 的默认商店

修改 docker 的/usr/lib/code-server/lib/vscode/product.json 文件添加以下几行

1
2
3
4
5
6
7
"extensionsGallery": {
"serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
"cacheUrl": "https://vscode.blob.core.windows.net/gallery/index",
"itemUrl": "https://marketplace.visualstudio.com/items",
"controlUrl": "",
"recommendationsUrl": ""
},
,