Docker Plugin

Docker Plugin

Docker integration resembles AWS and utilises Docker container labels. Labels can be assigned to the connector at instantiation or at any time after. The integration is done via Docker daemon socket “docker.sock

We can run connector code directly on the docker Host system or as a container, as long as the code has read access to the daemon unix socket and network connectivity is permitted.

The YAML configuration, unlike AWS, does not require any DC variables. Labels format and configuration is the same for Docker containers as for EC2

1. create plugin specific “docker_plugin” section containing our discovery group name with access definitions
docker_plugin:
    - group: docker_team
      policies: [my-docker-policy]

2. Add tags to docker containers with following format:
2.1. Key: border0_someName

The Key must start with “border0” and can be followed by any alphanumeric set of characters, eg: border0_http, border0_server01, border01

2.2. Value: port=1234,type=http,group=docker_team

The tag value represents CSV encoded parameters for a given socket.

  • group : the name of aws group defined in the YAML
  • port : the TCP port we wish to expose via the socket
  • type : one of the supported types of sockets: ssh, http, database, tls

Complete tag with value will look like this:

Key: border0_www
Value: port=80,type=http,group=docker_team

Example: Nginx based web server container running on internal port 80

docker run -l "border0_www=group=docker_team,port=80,type=http" -d  nginx:latest

🚧

Tags and quotes

Please be aware of single and double quoting across different platforms.

Verify applied tags:

ubuntu@dockerhost01:~$ docker inspect --format '{{ .Config.Labels }}' $my_container_id

map [
maintainer:NGINX Docker Maintainers <[email protected]> 
border0_www:group=docker_team,port=80,type=http
]