liveBook · Manning

Native executable

As explained in Learn Docker in a Month of Lunches, Second Edition

A native binary is an executable program compiled for a specific operating-system and processor platform without requiring a separate language runtime.

A native executable is a complete application compiled for a specific operating-system and processor platform. It runs without a separate language runtime, making it useful for small container images. section 4.4

A native executable matters when you package applications:

  • Go can compile applications for Windows, Linux, Intel, or Arm. section 4.4
  • The compiled output can be copied into a minimal final container image. section 4.4
  • Linux binaries must be explicitly marked executable with chmod; this has no effect on Windows. section 4.4

Building a Go executable in Docker

A builder stage runs go build -o /server, and the final stage copies /server into a minimal image before starting it as the container command.

How Learn Docker in a Month of Lunches, Second Edition covers it

How deep it goes
Explains compilation targets, runtime independence, multi-stage copying, and Linux permissions through a concrete Dockerfile.
Examples
Uses a Go web application, a /server binary, minimal container stages, chmod, and a 35.1MB image.
What it assumes
Assumes basic Dockerfile and container knowledge while showing the source-to-binary packaging workflow.
What you can do after
Builds a Go binary in Docker and packages it into a minimal runnable image.
How it connects
Connects Go with Rust, C/C++, Docker, multi-stage Dockerfiles, and language runtimes such as Java, .NET, Node.js, and Python.

Also explained in

Compare how 4 books explain native executable →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Docker in a Month of Lunches, Second Edition. The section links point to the parts of the book it draws on.