Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,5 @@ In case of system resource related errors or on windows docker restore after sle
3. To clean up docker run `docker rm -vf $(docker ps -aq)`


## Running in Docker in Docker
See this note for refrence here
## Running in Docker in Docker (WIP)
See [README](./dind#readme).
30 changes: 19 additions & 11 deletions scripts/dind/Dockerfile.kurtosis_dind
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
FROM mcr.microsoft.com/devcontainers/base:bullseye
FROM docker:dind

# Get Go
RUN apt install git curl tar && \
curl https://dl.google.com/go/go1.21.3.linux-amd64.tar.gz -o go.tar.gz && \
# Create the /etc/machine-id file
RUN apk add --no-cache dbus && \
dbus-uuidgen > /etc/machine-id

# Install required packages
RUN apk add --no-cache git curl tar

# Download and install Go
RUN curl https://dl.google.com/go/go1.21.3.linux-amd64.tar.gz -o go.tar.gz && \
tar -C /usr/local -xzf go.tar.gz && \
rm go.tar.gz

# Set up Go environment variables
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
RUN mkdir -p "${GOPATH}/src" "${GOPATH}/bin" && chmod -R 777 "${GOPATH}"

# Download and install Kurtosis CLI
RUN curl -L "https://github.com/kurtosis-tech/kurtosis-cli-release-artifacts/releases/download/0.85.3/kurtosis-cli_0.85.3_linux_amd64.tar.gz" -o kurtosis-cli.tar.gz && \
tar -xzvf kurtosis-cli.tar.gz -C /usr/local/bin && \
rm kurtosis-cli.tar.gz

# Install Kurtosis
RUN echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | tee /etc/apt/sources.list.d/kurtosis.list
RUN sudo apt update && \
sudo apt install kurtosis-cli
ADD . /go-ethereum
WORKDIR /go-ethereum/scripts/

WORKDIR /geth
COPY ../ .
ENV DOCKER_HOST=unix:///var/run/docker.sock
55 changes: 55 additions & 0 deletions scripts/dind/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Emulate Network Using Docker-in-Docker (DinD)

This documentation details the use of Docker-in-Docker (DinD) to emulate network environments for testing builder performance. This method provides an isolated environment, removing the need for Go or Kurtosis installations on the host system.

## Introduction

Utilizing a DinD setup allows developers to create a contained environment where Docker images can be built and Kurtosis enclaves can be managed. This is particularly useful for simulating network conditions in a clean state without affecting the host's setup.

## Running in a DinD Environment

### Prerequisites

- **Docker**: Ensure Docker is installed and running on your system. The DinD process will be running as a Docker container.

### Setup and Execution

1. **Create the DinD Environment**:
- Run a DinD container for an isolated build environment named `builder-dind-container` assuming you are currently in this folder:
```shell
docker build -f ./Dockerfile.kurtosis_dind -t builder-dind-image ../../
docker run -dit --privileged --name builder-dind-container builder-dind-image
```
***note:*** privileged mode that is not needed when using local hosting in your docker described [here](../)

2. **Build the Builder Image**:
- Execute the build command within the DinD environment:
```shell
docker exec builder-dind-container go run emulate_network.go build -t=custom-builder-tag
```

3. **Start the Enclave**:
- Start an enclave with the specified builder image:
```shell
docker exec builder-dind-container go run emulate_network.go run -n=builder-enclave -t=custom-builder-tag
```

4. **Stop the Enclave**:
- To stop a running enclave, use the following command:
```shell
docker exec builder-dind-container go run emulate_network.go stop -n=builder-enclave
```

5. **Cleanup**:
- To stop and remove the DinD container, execute:
```shell
docker stop builder-dind-container
docker rm builder-dind-container
```

**Note**: Replace `builder-dind-container` with a descriptive name relevant to your project, and `builder-dind-image` with the image name you've prepared for the DinD environment. The `custom-builder-tag` should be replaced with the actual tag name you wish to assign to your builder image.

## Known Issues and Solutions
Ports control is missing in ethereum-package.

By following these instructions, developers can leverage a Docker-in-Docker approach to emulate networks and test builder performance in a controlled and isolated manner.