I have a golang docker container. My Dockerfile contains:
FROM docker.io/golang:1.21.7-alpine3.19 AS builder
In my local everthing works fine. I can run this command in my golang project:
cmd := exec.Command("go", "run", "anotherProgram.go", param1, param2)
But when I run this command in my docker container, I get this error:
exec: 'go': executable file not found in $PATH
I am sure 'anotherProgram.go' file exist in my container. What is the problem? How can I run another go file in my golang docker container?
I added these lines to my Dockerfile:
It works like a charm.