command
module
Version:
v0.0.0-...-4ec6632
Opens a new window with list of versions in this module.
Published: Aug 2, 2019
License: MIT
Opens a new window with license information.
Imports: 11
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
docons
consul service integration for docker container
docons
uses container id as consul service id, use container labels for other service definitions.
Container Labels
docons/name
, name of the service
docons/port
, port of the service
docons/tags
, comma separated tags of the service
docons/meta-XXX
, meta of the service, docons
is the reserved key
Usage
-
Install and start docker
-
Install and start consul
consul agent -dev -ui
-
Install and run docons
go install -u go.guoyk.net/docons
docons
-
Start a container with specified labels
docker run -d --network host --name nginx \
--label docons/name=demo --label docons/port=80 nginx
You can also set label by LABEL
command in Dockerfile
-
Query consul
by browsing Web UI http://127.0.0.1:8500
You will see a service with name demo
and port 80
is registered automatically
-
Stop the container
docker stop nginx
-
Check consul
Web UI again
You will see that service is unregistered automatically.
Credits
Guo Y.K., MIT License
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.