Any reason for packaging go executables in containers?

I am new to go and I don’t have much experience with how it is used in production environments. I see that by default Go generates a statically linked executable. What it means is that at runtime the executable would only depend on the Kernel system calls and will have zero dependency on shared objects. Due to static linking, go executables carry their environment with them so the problem solved by Docker containers (of environment variability) would not be needed. Am I missing something? I get that without packaging it in containers, we would lose the ability to use it in Kubernetes pods.

If I understood you correctly yes golang uses its own runtime, you want to run your go application in Kub, then it should be packaged in Docker container, Kubernetes is a container orchestrator, and without this there is no way.
If you develop an application on different machines, then it will be easier for you to pack it in containers so that you do not constantly configure it on the golang, but it is not necessary to use containers, it’s just much easier with them to deploy, transfer to other machines

You are not missing anything. A go executable is often all you need to deploy to a server.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.