I have seen some websites such as Tryit on the official Docker website. Terminal in it really sends the command to the server for execution and returns the result or how to do it? PS: I tried to write a code in PHP. The front-end submits the obtained command and PHP executes the code using exec () and other functions.
Docker
Try it on the official website.
Terminal
Is it true that the command is sent to the server for execution and the result is returned?
PS:
I tried to write one in PHP. The front-end submits the obtained command.exec()
And the like. However, although some simple commands can be executed in this way, it can be said that it cannot achieve the effect of others. First, it is insecure, and second, it cannot run images.iPython
And other interactive environments.
Reply content:
I see some websites suchDocker
Try it on the official website.Terminal
Is it true that the command is sent to the server for execution and the result is returned?
PS:
I tried to write one in PHP. The front-end submits the obtained command.exec()
And the like. However, although some simple commands can be executed in this way, it can be said that it cannot achieve the effect of others. First, it is insecure, and second, it cannot run images.iPython
And other interactive environments.
- First, it is clear that it is sent to the server rather than js for execution.
- I personally guess that it is unlikely to be a simulator, because it is necessary to re-implement almost all docker commands. It is possible that the program name is filtered out first (for example, only commands such as help and docker are allowed), and then the exec function is called.
- For security, you can switch to a restricted user before executing the program.
I have seen a similar jslinux, it should be a shell simulated by js (not very sure)
Http://bellard.org/jslinux/
However, there is a similar Terminal in VPS, which seems to be a real shell.
Https://github.com/jcubic/jquery.terminal. This can be real.
It's easy.
Wssh solves the problem you want [nodejs is doing well in this aspect
Docker will prompt you after entering ls-l:
This is an emulator, not a shell. Try following the instructions.