Home>Article>Backend Development> Why did docker choose golang for development?
Docker is an advanced container engine based on LXC open sourced by PaaS provider dotCloud. The source code is hosted on Github. It is open source based on the Go language and complies with the Apache2.0 protocol.
Although Docker is written in Golang, it can run directly without installing Golang. So there is this question: Why does Docker not need to install Golang?
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 at least requires the Python development environment to be installed, and sometimes open source tools also need to install other Python's 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 converts each bytecode to be executed. Send it to the interpreter, 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.
Why did Docker choose to use Golang for development?
First of all, our current mainstream services all use Unix/Linux operating systems, and Golang has very little dependence on third parties (only glibc). This is both a limitation and an advantage. Because in this case, Docker developed using Golang can basically run perfectly on most servers installed with Unix/Linux operating systems.
Summary
Many programming languages have some limitations and shortcomings, but we have to choose a programming language according to our own needs, sometimes in specific scenarios Choosing a more suitable programming language may bring greater benefits. This also applies to the choice of framework. It is not necessarily the high-end or popular framework that everyone says is good, but the best one that suits your business.
Recommended learning:go video tutorial
The above is the detailed content of Why did docker choose golang for development?. For more information, please follow other related articles on the PHP Chinese website!