How to Use Docker-in-Docker with the InternetIncome Script: Complete Setup Guide

The InternetIncome script automatically detects Docker-in-Docker environments by spawning a temporary test container and adjusts its workflow to disable GUI-dependent applications while allowing proxy-based services to run normally.

The engageub/internetIncome repository provides an automation framework for managing multiple internet bandwidth-sharing applications through Docker containers. When deploying this solution inside a Docker-in-Docker (DinD) environment, the internetIncome.sh script detects the nested container context and adapts its behavior to ensure compatible services remain operational while preventing incompatible GUI-dependent applications from launching.

How the Script Detects Docker-in-Docker

The detection logic resides in the main orchestration file internetIncome.sh. The script initializes a boolean flag at line 65 to track the environment state throughout execution.

The Detection Mechanism

At lines 152-154, the script validates the DinD environment by attempting to run a temporary docker:18.06.2-dind container:

docker_in_docker_detected=false                # definition at L65

...
if sudo docker run --rm \
    --mount type=bind,source=$PWD,target=/output \
    docker:18.06.2-dind sh -c \
    "if [ ! -f /output/$dns_resolver_file ]; then exit 0; else exit 1; fi"; then
    docker_in_docker_detected=true            # set when DinD is present (L152-L154)

fi

This command mounts the current working directory ($PWD) into /output within the test container and checks for the existence of a DNS resolver configuration file. If the container executes successfully, the script sets docker_in_docker_detected=true, confirming the presence of a Docker-in-Docker environment according to the source code at internetIncome.sh#L152-L154.

Resolver File Preparation

Before launching application containers, the script writes a default resolv.conf directly into the host directory at lines 144-148. This step ensures proper DNS resolution within the nested container architecture, bypassing the need for host-level networking modifications that are unavailable in DinD contexts.

Application Compatibility and Restrictions

When docker_in_docker_detected equals true, the script enforces specific feature restrictions to prevent runtime errors in the constrained environment.

Blocked GUI-Dependent Applications

The script explicitly aborts execution for Adnade and Ebesucher when running inside DinD. These applications require direct host GUI interaction that is inaccessible within nested containers. At lines 311, 374, and 440, the script outputs an error message and exits:

if [ "$docker_in_docker_detected" = true ]; then
    echo -e "${RED}Adnade and Ebesucher are not supported now in Docker-in-Docker ...${NOCOLOUR}"
    exit 1
fi

As implemented in internetIncome.sh#L311, this validation prevents users from attempting to launch incompatible browser-automation services that would fail without host display access.

Supported Proxy-Based Services

All other applications—including EarnApp, PacketStream, Honeygain, and similar proxy-based bandwidth sharers—function normally within DinD. These services rely solely on network connectivity rather than host-level GUI access, making them compatible with the nested container architecture.

Implementing Docker-in-Docker Deployment

To run the InternetIncome script inside a Docker-in-Docker environment, you must launch a parent container with appropriate privileges and volume mounts that expose the host Docker daemon.

Docker Run Command

Execute the following command to start the script within a privileged container that has access to the host Docker socket:

docker run --rm -it \
    --privileged \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v "$(pwd)":/app \
    -w /app \
    bash:latest \
    bash -c "chmod +x internetIncome.sh && sudo ./internetIncome.sh --start"

This configuration mounts the Docker socket to allow the inner script to spawn sibling containers on the host, maps the current directory to /app for configuration access, and uses --privileged mode to grant necessary capabilities for network management.

Docker Compose Configuration

Alternatively, use the following docker-compose.yml specification for persistent deployments:

version: "3.8"
services:
  internet-income:
    image: bash:latest
    privileged: true
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - .:/app
    working_dir: /app
    command: >
      bash -c "chmod +x internetIncome.sh &&
               sudo ./internetIncome.sh --start"

Run docker compose up to initialize the service. This approach provides better orchestration capabilities and restart policies for long-running income generation tasks.

Summary

  • The internetIncome.sh script automatically detects Docker-in-Docker by testing container execution with a docker:18.06.2-dind image at lines 152-154.
  • When DinD is detected, the script sets docker_in_docker_detected=true and adjusts DNS resolver configuration at lines 144-148.
  • Adnade and Ebesucher are explicitly blocked in DinD environments (lines 311, 374, 440) due to GUI dependency requirements.
  • Proxy-based services like EarnApp, PacketStream, and Honeygain operate normally without requiring host GUI access.
  • Deployment requires mounting the host Docker socket and running with --privileged mode to enable nested container management.

Frequently Asked Questions

How does the InternetIncome script know it is running inside Docker-in-Docker?

The script attempts to run a temporary docker:18.06.2-dind container that mounts the current directory to /output. If this container executes successfully, the docker_in_docker_detected variable is set to true at line 154, confirming the DinD environment according to the source code.

Why are Adnade and Ebesucher blocked in Docker-in-Docker mode?

These applications require direct host GUI interaction and browser automation that cannot function within a nested container context. The script checks docker_in_docker_detected at lines 311, 374, and 440, and exits with an error message to prevent runtime failures.

Can I run EarnApp and Honeygain inside Docker-in-Docker?

Yes. These proxy-based services only require network connectivity and do not depend on host-level GUI access. According to the source code in internetIncome.sh, they launch normally when DinD is detected, unlike the GUI-dependent applications that get blocked.

Is the --privileged flag required for Docker-in-Docker deployment?

While optional in some configurations, --privileged is recommended because the script executes sudo docker commands and may require additional capabilities like NET_ADMIN for network management within the nested environment. Mounting /var/run/docker.sock is mandatory for container sibling access.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →