Why did Docker choose to use Golang for development?
First of all, our current mainstream services all use Unix/Linux operating systems, and as described earlier, Golang has very little dependence on third parties (only Depends on glibc), which is both a limitation and an advantage. (Recommended learning: go)
Because in this case, Docker developed using Golang can basically run perfectly on most servers with Unix/Linux operating systems installed.
Why does Docker not require Golang to be installed?
The question why Docker does not require Golang to be installed is because I am a Java background developer, and some open source tools developed in Python are used on Ubuntu, and both Java and Python open source tools require Install the corresponding operating environment:
Java requires at least JRE to be installed, and sometimes JDK is also installed for convenience
Python requires at least the Python development environment to be installed, and sometimes open source tools also need to install other Pythons Third-party package
Take Java as an example. The Java source program is compiled by the compiler and becomes bytecode. The bytecode is interpreted and executed by the virtual machine. The virtual machine sends each bytecode to be executed to The interpreter translates it into machine code on a specific machine and then runs it on the specific machine.
Both the compiler and the interpreter are actually part of the JVM. Java's platform independence is actually achieved by JVM, and Java programs also need to run on JVM.
But Golang compiles and generates a static executable file with no other external dependencies except glibc.
So what is glibc?
In fact, glibc is the libc library released by GNU, which is the c runtime library. Glibc is the lowest-level API in the Linux system, and almost any other running library depends on glibc. This also means that docker can actually run without Golang on Unix/Linux systems.
The above is the detailed content of Why docker is developed with golang. For more information, please follow other related articles on the PHP Chinese website!