What is happing?
When you are trying to build the app the required deps are not installed in the docker image
Why it occurs in the docker image and not in my local dev env?
In your local dev env you install/get the required deps running commands like the following example.
$ go get -u github.com/go-swagger/go-swagger/cmd/swagger
But each container/image will be an empty/clean env. You need to tell for the docker container that is required to first install the deps.
Use Makefiles to create task/commands for your project. See more over it here
Create a make file command to install the deps and build the project
.PHONY: setup setup: @echo Installing dependencies: go get -u github.com/go-swagger/go-swagger/cmd/swagger .PHONY: build build: setup go build -o $(BINARY) $(APP_FILE)
Then the command
make buildneed be called to create your image instead of the go build used currently.
Instead of using the
go getcommands for each dependency use the go dep manager to do it. Following the example.
.PHONY: setup setup: @echo Installing dependencies: dep ensure
See more about it here