Bookmark

VSCodium trong Docker: IDE web cho HomeLab ở cổng 8003

VSCodium là bản build cộng đồng của Visual Studio Code, hướng tới binary không kèm telemetry/tracking của Microsoft. Tutorial i12bretro chạy bản LinuxServer trong Docker, lưu configcode ra host, rồi mở IDE ở cổng 8003.1

Youtube video player

Video gốc đã được xác thực bằng oEmbed và được nhúng qua shortcode hiện có.2

Cài Docker

Đăng nhập Linux Docker host:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# install prerequisites
sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y
# add docker gpg key
curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -
# add docker software repository
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"
# install docker
sudo apt install docker-ce docker-compose containerd.io -y
# enable and start docker service
sudo systemctl enable docker && sudo systemctl start docker
# add the current user to the docker group
sudo usermod -aG docker $USER
# reauthenticate for the new group membership to take effect
su - $USER

Chạy VSCodium

Xem UID/GID, tạo hai thư mục persistent rồi chạy container. Source dùng id $user; tôi giữ nguyên và kiểm tra biến shell trước khi thay PUID/PGID:

1
2
3
4
5
6
7
# list current uid and gid, note these for later
id $user
# create working directories
mkdir ~/docker/vscodium/{config,code} -p
# run the vscodium docker image
# replace PUID, GUID with the output of the id $user command above
docker run -d --name=vscodium --cap-add=IPC_LOCK -e PUID=1000 -e PGID=1000 -e TZ=America/New_York -p 8003:3000 -v ~/docker/vscodium/config:/config -v ~/docker/vscodium/code:/code --shm-size="1gb" --restart unless-stopped lscr.io/linuxserver/vscodium:latest

Mở http://localhost:8003 theo source, hoặc thay localhost bằng DNS/IP của host khi truy cập từ máy khác. Container có --cap-add=IPC_LOCK, shared memory 1GB, và ghi dữ liệu vào hai thư mục host.

Kiểm tra và giới hạn

Kiểm tra docker ps, docker logs vscodium, quyền đọc/ghi ~/docker/vscodium/config~/docker/vscodium/code. Không expose IDE trực tiếp ra Internet; dùng reverse proxy có authentication hoặc VPN. Backup code/config trước khi update image, và kiểm tra extension có nguồn tin cậy.

Nguồn


  1. https://i12bretro.github.io/tutorials/0985.html — i12bretro tutorial 0985. Tutorial được biên tập độc lập từ numbered HTML page; UID/GID, port, path và capability được giữ nguyên. ↩︎

  2. https://www.youtube.com/watch?v=dJgh13kYmoI — Run VSCodium Containerized in Docker — i12bretro ↩︎


0 Bình luận

Góp Ý / Bình Luận / Đánh giá