Multiple Docker Resources
While developing the challenge you might come across an instance where you need to integrate multiple docker in the hacking lab platform.
There are multiple ways to do that.
References to other Wiki Articles
Multi-Docker Exposures
HL does only list one URL per resource. If you do multi-docker resources, only one will be listed in the user ui. Thus, a multi-docker nginx will do the routes to the other dockers.
As you can see in the Image 1, if you have multiple docker exposed to the challenge users then you should go with the nginx approach
.
NGINX Helper Page
The purpose of the nginx helper page is to have an entry point for the other dockers used in the docker-compose.
Multi-Docker Expose Example
You can add multiple services using the nginx
approach. The variable hobo
will held the unique docker id when the docker manager is launching the resource. Keep an eye on the following
hobo
hobo-1
hobo-2
services:
CHALLENGE_NAME-hobo:
image: REGISTRY_BASE_URL/CHALLENGE_NAME:stable
hostname: 'hobo'
environment:
- "domainname=idocker.REALM_DOMAIN_SUFFIX"
- "SERVICES=hobo"
cpus: 1
mem_limit: 128M
labels:
- "traefik.port=80"
- "traefik.frontend.rule=Host:hobo.idocker.REALM_DOMAIN_SUFFIX"
- "traefik.protocol=http"
CHALLENGE_NAME-hobo-1:
image: REGISTRY_BASE_URL/CHALLENGE_NAME:stable
hostname: 'hobo-1'
networks:
- hobo
- tmp_default
environment:
- "domainname=idocker.REALM_DOMAIN_SUFFIX"
cpus: 1
mem_limit: 128M
labels:
- "traefik.port=7681"
- "traefik.frontend.rule=Host:hobo-1.idocker.REALM_DOMAIN_SUFFIX"
- "traefik.protocol=http"
networks:
hobo:
tmp_default:
external: true
For example in snippet above, developer can create multiple instance of CHALLENGE_NAME
Example of this setup
Multi-Docker with one exposed service
If there is only one exposed app in a multi-docker scenario, then developers can follow the following methods shown in Image - 2
Developers can use the DB inside the app itself ( private ) or can do the all separate.