164 words
1 minute
Configure Docker + code-server on Alibaba Cloud to Build an Online Compiler
Alibaba Cloud: Configure Docker + code-server to enable an online compiler
1. Install Docker
- Install Docker
Docker has two branch versions: Docker CE and Docker EE, i.e., Community Edition and Enterprise Edition. This experiment uses Docker CE.
- Install Docker dependencies and add Docker’s software repository information
yum install -y yum-utils device-mapper-persistent-data lvm2yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo- Install Docker
yum makecache fast //更新yum缓存yum -y install docker-cedocker info //查看安装状态- Start the Docker service
systemctl start docker //启动docker服务systemctl status docker //查看docker状态systemctl enable docker //设置docker开机启动- Configure Alibaba Cloud image registry (image acceleration)
- Go to the Alibaba Cloud Image Accelerator interface
- Follow the operation guide to configure
sudo mkdir -p /etc/dockersudo tee /etc/docker/daemon.json <<-'EOF'{ "registry-mirrors": ["https://0o9w7e5n.mirror.aliyuncs.com"]}EOFsudo systemctl daemon-reloadsudo systemctl restart docker- Reload after configuration
systemctl daemon-reload //重新加载服务配置文件systemctl restart docker //重启Docker服务- Run Nginx via Docker
- Get the latest Nginx image
docker search nginx //查看Nginx可用版本docker pull nginx:latest //拉取镜像docker images //查看本地镜像- Run Nginx
docker run --name nginx-test -p 8080:80 -d nginxAccess port 8080 to see the Nginx home page, running normally.
2. Install code-server
- Install code-server
curl -fOL https://github.com/cdr/code-server/releases/download/v4.4.0/code-server-4.4.0-amd64.rpmsudo rpm -i code-server-4.4.0-amd64.rpmsudo systemctl enable --now code-server@dreaife- Configure code-server
sudo systemctl enable --now code-server@dreaife //启动coder-server服务sudo vi ~/.config/code-server/config.yaml //修改配置文件sudo systemctl restart code-sercer@dreaife //重启code-server- Deploy code-server to listen on 0.0.0.0
sudo vi ~/.config/code-server/config.yaml //修改配置文件sudo systemctl restart code-sercer@dreaife //重启code-serverfirewall-cmd --zone=public --add-port=7777/tcp --permanent //开放端口After installation, enter the code-server interface
3. Configure the code-server build environment
- Install the C/C++ components of code-server via VSIX
- Enable .vscode configuration files
- c_cpp_properties.json

- launch.json

- tasks.json

- Test installation results
- Create a test file test.cpp
#include<iostream>#include<algorithm>#include<string>using namespace std;typedef long long ll;const int N = 1e5+10;int n,a[N];string s;void solve(){ cout<<"hello"<<endl;}int main(){ int _;cin>>_; while(_--) solve(); return 0;}- Run the test

The run is successful, the result is correct, and the online compiler configuration is complete.
Share
If this article helped you, please share it with others!
Configure Docker + code-server on Alibaba Cloud to Build an Online Compiler
https://dreaife.tokyo/en/posts/alicloud-docker-coder/ Some information may be outdated
Related Posts Smart
1
Forwarding Network Traffic to a Router via NAT on Ubuntu
cs-base Configure Netplan, enable IP forwarding, and set up NAT to allow Ubuntu to share its network connection with a router. The process includes clearing existing configurations, assigning a static IP address, installing and configuring a DHCP service, and verifying that network sharing works correctly.
2
Installing Oh My Zsh and Its Plugins on Ubuntu
cs-base To install Oh My Zsh and its components on Ubuntu, first install Zsh and Git, then install Oh My Zsh using wget. Next, clone the Powerlevel10k theme and required plugins, and update the .zshrc file to enable them. Finally, install additional plugins such as zsh-bat and you-should-use, and update the system to ensure everything works properly.
3
About Errors When Using pandas.to_datetime with Different Time Formats
cs-base When using the pandas to_datetime function, errors may occur if date values use different formats. Setting the format parameter to 'mixed' can solve issues caused by inconsistent formats. Example code shows how to handle invalid date formats and successfully convert values to datetime.
4
CSAPP Chapter 1: A Tour of Computer Systems
cs-base A computer system consists of hardware and system software and runs applications through a program life cycle of creation, execution, output, and termination. Information is made of bits and context, and programs are transformed into executables by the compilation system. The processor reads and executes instructions, using caches to improve performance. The operating system manages hardware and provides abstractions such as processes and virtual memory to support concurrency and parallelism. Abstraction is a core concept in computer science, and virtual machines provide an abstraction of an entire computer.
5
missing-semester-class01
cs-base Introduces the basic features and usage of the shell, including running programs, navigating paths, managing file permissions, redirecting input and output streams, and administering root privileges. It also provides multiple Bash command examples and exercises to reinforce the material.
Random Posts Random
1
Auction Platform Built with Nest.js and Angular—with Jest Testing and CI/CD
PROJECT 2024-12-07
2
An EVM wallet login interface for EOAs
WEB3 2026-06-08
3
Angular-Based Animation Showcase Website with Login and Registration (Cognito)
PROJECT 2024-11-12
4
About an EOA Wallet Signature Verification and Related Content
WEB3 2026-06-10
5
Getting Started with VSCode Plugin Development
plugin 2025-03-13





