Skip to content

shotai/dockerthing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker thing


## /Consul If need to change the configuration file's path, please override the ENTRYPOINT.
Example:
` ENTRYPOINT ["/bin/consul", "agent", "-server", "-config-dir=$PATH"] `
Note: the environment variable cannot be translated in ENTRYPOINT unless use /bin/bash.

Specify the advertise address with the local address for other machines in cluster finding it.
If run with --net=host and not specify the advertise address, then it will use eth0's ip.
If not bind to localhost, need to expose 8301-8302/udp, 8300-8302/tcp, 8400/tcp, 8500/tcp, 8600/tcp, 8600/udp.

Example cmd for DOCKER RUN
`docker run --net=host --name=consul --rm consul -bootstrap -node m1 -advertise 192.168.0.5 -join 192.168.0.5 `
Note:
1. The config in docker file can be overrided.
2. The node can join itself.
3. One cluster can only have one node in bootstrap mode.
4. The advertise address should be in the cluster ip range.
5. If the hostnames are same, please specify -node in consul configuration.

## /Registrator Need to provide consul address. Add -ip flag to bind ip address.

According to registrator doc, the best way is to use --net=host for docker run.
Need to configure the shared files when running.
Example cmd for DOCKER RUN
`docker run --net=host --name=resgistrator --rm --volume=/var/run/docker.sock:/tmp/docker.sock registrator -consul=192.168.0.5 -ip=192.168.0.5`
Note:
1. the CMD of docker file using default consul url (localhost:8500)
2. the `-ip` flage specified the ip address for register service.
3. the `-resync 10` will resynchronize consul info every 10 seconds.

## /nginxconsultemplate Need to provide consul address. `-e CONSULADDR`
Add consul template file.
For socket io, need `ip_hash` for nginx
Example cmd for DOCKER RUN
`docker run --net=host --name=nc --rm -e CONSULADDR=192.168.0.5 nc `

About

docker work

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published