Home > Backend Development > Golang > Why did docker choose golang for development?

Why did docker choose golang for development?

青灯夜游
Release: 2019-12-23 13:58:20
Original
3909 people have browsed it

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.

Why did docker choose golang for development?

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template