Hello.
I want to make a service like a code executor in hashcode.
The way I thought about creating a service is
When a user submits a source code (from the client), for example, java,
On the web server...Results of creating, compiling, and executing java files
I thought about how to return it to the user.
The above method was actually developed.
The problem with this is that executing malicious code can cause the server to crash
A virtual machine running the source was required.
So I looked into cloudide or webide, and everyone told me to look into docker.
By the way, I am studying docker, but there is a way to drive docker in the terminal
It doesn't tell me how to run a docker on a web server.
Is the methodology different?
제가 원하는 것은 사용자가 코드를 제출하면 (어떤 언어든) 웹서버에서 그 코드를 실행할 수 있는
Create a docker container, execute the code here, return his results to the web server, and
I want to deliver it to the client again.
What should I do if my way of thinking is wrong?
Development environment is nodejs expressjs reaction
docker web-ide code-runner
That's the way you said it.
Hash code and programmers are also running code in the docker environment. I don't know in which language you develop web applications, but there is a library that creates and runs docker containers for each language.
https://docs.docker.com/engine/api/sdks/
For your information, if the code is large when executing it, it cannot be handed over to the command line parameter, so you can save the generated code as a file and use volume mount to access it from the container. And you can use stdout and stderr as a result of execution.
© 2024 OneMinuteCode. All rights reserved.