gin
gin copied to clipboard
gin run inside docker container
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 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.
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
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