Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Golang production code boilerplate with Redis, MongoDB, Docker and Logger including the best practices.

License

NotificationsYou must be signed in to change notification settings

amanboss9/Go_Docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang production code boilerplate with Redis, MongoDB, Docker and Logger including the best practices.

Pre Requisite:

  • docker
  • docker imagemongo

Start MongoDB on docker:

sudo docker run -v "$(pwd)":/data --name mongo -d mongo mongod --smallfiles

sudo docker run -it --link mongo:mongo --rm mongo sh -c 'exec mongo "$MONGO_PORT_27017_TCP_ADDR:$MONGO_PORT_27017_TCP_PORT/test"'

Make Go build:

  • Before creating the build, Check theDbHost in conf.json and change it tomongo address in docker which can be found with below command:sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mongo

go build

Docker Build :

sudo docker build -t go_docker .

sudo docker run --name=go_docker -d -p 9003:9003 go_docker:latest

Run and Check:

  • Please check yourdockerhostAddress with the help of below command:

sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container-id

  • To get thecontainer-id use below docker command:

sudo docker ps

http://dockerhostAddress:9235/one

Other important command:

  • List all containers(ID)docker ps -aq
  • Stop all containersdocker stop $(docker ps -aq)
  • Stop indivisual containerdocker stop container-id
  • Remove all containersdocker rm $(docker ps -aq) ordocker ps -aq --no-trunc -f status=exited | xargs docker rm
  • Remove already in use containerdocker rm container-id
  • Remove all Imagesdocker rmi $(docker images -q)

About

Golang production code boilerplate with Redis, MongoDB, Docker and Logger including the best practices.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp