gin icon indicating copy to clipboard operation
gin copied to clipboard

gin run inside docker container

Open Nebudev opened this issue 7 years ago • 3 comments

Hello, i am new in Go and was trying to run it with docker the problem is that if made some change after starting the container the code won't recompile and it really sucks, i have to reload the container to see the changes. Any suggestions?

Regards

Nebudev avatar Jun 02 '17 00:06 Nebudev

@Nebudev Have you volume mount your folder ? Your docker should looks something like this,

docker run -p 3000:3000 -v `pwd`:/go/src/example-app --name="test" -d example-app

The -v is the volume mount option, so that you can watch file changes inside docker container.

michaeleekk avatar Jul 06 '17 04:07 michaeleekk

I am actually running into a similar issue, I get this when making any changes to code:

╭─[email protected] ~/go/src/bitbucket.org/dittolive/api  ‹master*› 
╰─➤  docker-compose logs
Attaching to api_ditto-api_1
ditto-api_1  | [gin] Listening on port 3000
ditto-api_1  | [gin] Building...
ditto-api_1  | [gin] Build finished
ditto-api_1  | [gin] Building...
ditto-api_1  | 2017/09/10 21:43:05 Error running: fork/exec /go/src/bitbucket.org/dittolive/api/gin-bin: text file busy

EDIT: Found the source of this issue, which may help to track it down (it is totally possible I need to add a signal handler in my application code) it seems if I hit the webserver at the same time that gin is restarting the process, it breaks gin with an error saying that gin-bin text file is busy

thatnerdjosh avatar Sep 10 '17 21:09 thatnerdjosh

My Dockerfile and Docker Compose has always worked for me on both windows and linux. Ignore most of those app installs, that's for ffmpeg

EliCDavis avatar Aug 15 '19 14:08 EliCDavis