Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] Running Minikube Inside a Docker-in-Docker Setup Within Jenkins: Addressing Network and IP Configuration Issues #20364

Open
furkantarikgocmen opened this issue Feb 5, 2025 · 0 comments

Comments

@furkantarikgocmen
Copy link

What Happened?

I am running Jenkins inside a Docker container (Container A) and attempting to run start Minikube within this container, which in turn runs another Docker container (Container B). However, I am encountering the following issues:

  1. IP Address Conflict with Minikube's --network Parameter:
  • Problem: When specifying a Docker network for Minikube using the --network parameter, I receive an IP address conflict error, necessitating the manual assignment of a static IP address.

  • Question: What causes this conflict, and is there a more efficient method to resolve it?

  1. Timeout Error Due to Loopback Address:
  • Problem: After assigning a static IP address along with the network, the Minikube container starts successfully. However, the Minikube process running inside Jenkins (Container A) times out when attempting to access the Minikube container (Container B), as it tries to connect via the loopback address 127.0.0.1.

  • Question: What is the best approach to ensure that Jenkins can communicate with the Minikube container without encountering this timeout issue?

I would appreciate guidance on resolving these challenges to facilitate seamless integration between Jenkins and Minikube within Docker containers.

Compose File

version: '3.9'

services:
  jenkins:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: jenkins-server
    ports:
      - "8080:8080"    # Expose Jenkins UI on port 8080
      - "50000:50000"  # Expose port for Jenkins agents
    volumes:
      - jenkins_home:/var/jenkins_home   # Persistent Jenkins data
      - /var/run/docker.sock.raw:/var/run/docker.sock # Mount Docker socket for Docker builds
      - ../k8s:/var/jenkins_home/k8s # Mount Kubernetes configuration files (optional)
      - ./init.groovy.d:/var/jenkins_home/init.groovy.d # Mount Jenkins init scripts (optional)
    environment:
      JAVA_OPTS: "-Djenkins.install.runSetupWizard=false" # Skip setup wizard (optional)
    user: root # Run as root to allow installing dependencies
    privileged: true
    networks:
      - minikube-net  # Minikube network

volumes:
  jenkins_home:

networks:
  minikube-net:
    external: true

Minikube Start

minikube start \
  --driver=docker \
  --network=minikube-net \
  --subnet=172.18.0.0/16 \
  --static-ip=172.18.0.5 \
  --memory=3900mb \
  --cpus=2 \
  --apiserver-ips=172.18.0.5 \
  --force

Enivronment

Docker Desktop 4.37.1 (WSL2)

Driver
Docker

Attach the log file

minikube_logs.txt

Operating System

Windows

Driver

Docker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant