Docker Community Forums

Share and learn in the Docker community.

Docker run -it <image> go install <args>

I am building this program:

The program was built successfully in one shot using the Makefile. All docker images were built as expected.

There is this line in the Makefile:
-v $(abspath build/docker/bin):/opt/gopath/bin
-v $(abspath build/docker/$(TARGET)/pkg):/opt/gopath/pkg
go install -compiler gccgo -ldflags “$(DOCKER_GO_LDFLAGS)” $(pkgmap.$(@F))

DRUN = docker run -i --rm $(DOCKER_RUN_FLAGS)
-v $(abspath .):/opt/gopath/src/$(PKGNAME)
-w /opt/gopath/src/$(PKGNAME)

If I run this command manually with exact same , i.e.
start the docker container (docker run)
run the ‘go install’ command inside the container

It would not work. All object files are generated in their expected location, however, the binary cannot be generated.

In short, if I run it in one shot, it works. If I run it separately, it does not.
I am wondering whether there are catches/caveats on using this 'Docker run go install ’ style commands? Or whether there are some debugging methods for this type of issue? Can I stop the 'Docker run go install ’ command some place in the middle?