Skip to content
Open
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
2 changes: 1 addition & 1 deletion modules/ducktests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ All paths below are relative to `${IGNITE_HOME}/modules/ducktests/tests`:
Docker is used to emulate a distributed multi-node cluster environment where each individual container acts as a running cluster node.

### 1. Prerequisites
* **Docker** installed and running on your host system.
* **Docker** installed and running on your host system. A rootless daemon works too: the runner detects it and runs the `ducker` user as container root, which the daemon maps to you. Network fault tests then need the `iptables` and `sch_netem` kernel modules already loaded on the host, since a rootless container cannot load them.
* **Python >= 3.8** installed on your host system (required only for local environment scripts and development).

### 2. Prepare the Environment & Code
Expand Down
5 changes: 3 additions & 2 deletions modules/ducktests/tests/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,9 @@ ARG USER_GID=1000
RUN getent passwd ubuntu &>/dev/null && userdel -r ubuntu || true

# Provision ducker system environment and security configurations
RUN groupadd -g $USER_GID ducker \
&& useradd -u $USER_UID -g $USER_GID -ms /bin/bash ducker \
# -o lets ducker share uid and gid 0 with root in an image built for a rootless daemon (see ducker-ignite).
RUN groupadd -o -g $USER_GID ducker \
&& useradd -o -u $USER_UID -g $USER_GID -ms /bin/bash ducker \
&& mkdir -p /home/ducker/ \
&& rsync -aiq /root/.ssh/ /home/ducker/.ssh \
&& chown -R ducker /home/ducker/ /mnt/ /var/log/ /opt \
Expand Down
13 changes: 12 additions & 1 deletion modules/ducktests/tests/docker/ducker-ignite
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,17 @@ ducker_build_image() {
extra_build_args="--no-cache"
fi

# The ducker user must be able to write the checkout that ducker_run mounts. A rootless daemon
# maps only container root to the caller, so there ducker is built as uid 0.
local ducker_uid="$(id -u)"
local ducker_gid="$(id -g)"

if docker info --format '{{.SecurityOptions}}' 2>/dev/null | grep -q rootless; then
echo "** Rootless Docker detected: building ducker as uid 0."
ducker_uid=0
ducker_gid=0
fi

# Use SECONDS, a builtin bash variable that gets incremented each second, to measure the docker
# build duration.
SECONDS=0
Expand All @@ -275,7 +286,7 @@ ducker_build_image() {
# Tip: if you are scratching your head for some dependency problems that are referring to an old code version
# (for example java.lang.NoClassDefFoundError), add --no-cache flag to the build shall give you a clean start.
must_do -v -o docker build ${extra_build_args} --network=host --memory="${docker_build_memory_limit}" \
--build-arg USER_UID=$(id -u) --build-arg USER_GID=$(id -g) \
--build-arg USER_UID=${ducker_uid} --build-arg USER_GID=${ducker_gid} \
--build-arg "ducker_creator=${user_name}" --build-arg "jdk_version=${jdk_version}" \
--build-arg "python_version=${python_version}" -t "${image_name}" \
-f "${docker_context}/Dockerfile" -- "${docker_context}"
Expand Down
Loading