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
Experiment 8: Deployment and Application of a Web Server
cs-base This experiment aims to understand the structure of email systems, client-server communication, and SMTP/POP3 protocols. By installing and deploying Nginx and Apache on Alibaba Cloud, it demonstrates access to static and dynamic web pages, resolves dependency package installation issues, and improves understanding of Linux software configuration and programming ability.
2
Experiment 2: IP Protocol Analysis
cs-base This experiment aims to understand the IP packet format and the meaning of its fields, and to master the use of tcpdump and Wireshark. The environment includes an Alibaba Cloud host and operating systems. Through packet capture with tcpdump and analysis with Wireshark, it studies the IP protocol structure and related commands, resolves traceroute and Xftp connection issues, and improves programming ability and understanding of IP.
3
Experiment 5: Email
cs-base This experiment aims to understand the basic structure of email systems and communication protocols including SMTP and POP3. By sending and receiving emails using mail agents, clients, webmail, and telnet commands, the communication process and protocols are analyzed. The results show a clearer understanding of the detailed mail sending workflow and SMTP protocol analysis, improving programming ability and protocol understanding.
4
Experiment 7: HTTP Protocol Analysis and Measurement
cs-base This experiment aims to understand the HTTP protocol and its message structure, and to master HTTP packet capture and analysis using tcpdump and Wireshark. By downloading the Xinjiang University homepage, it analyzes the HTTP version, IP addresses, status code, content length, and header fields. A connection error encountered during the experiment was resolved, improving programming skills and understanding of HTTP.
5
Experiment 4: TCP Protocol Analysis
cs-base This experiment aims to understand the basic concepts of the TCP protocol and packet structure, analyze connection establishment and teardown, and master TCP protocol analysis using tcpdump and Wireshark. The experiment downloads a web page with wget and captures packets, analyzes TCP headers and fields, explores the three-way handshake and four-way termination processes, and summarizes issues and solutions encountered, improving understanding of IP protocols and TCP packet structure.





