Skip to content

Commit

Permalink
Merge pull request #726 from javipolo/ilab-auth
Browse files Browse the repository at this point in the history
RHELAI-787: Mount auth.json into ilab container
  • Loading branch information
rhatdan authored Aug 5, 2024
2 parents 701564e + 20d7d9a commit cc2447e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions training/ilab-wrapper/ilab
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ for PODMAN_MOUNT in "${ADDITIONAL_MOUNTS[@]}"; do
ADDITIONAL_MOUNT_OPTIONS+=("-v" "$PODMAN_MOUNT")
done

# Add pull-secret to additional mounts
# In case of normal user, $XDG_RUNTIME_DIR is used
if [[ -f ${XDG_RUNTIME_DIR}/containers/auth.json ]]; then
ADDITIONAL_MOUNT_OPTIONS+=("-v" "${XDG_RUNTIME_DIR}/containers/auth.json:/run/containers/0/auth.json")
# For root the main /run/containers is used
elif [[ -f /run/containers/${UID}/auth.json ]]; then
ADDITIONAL_MOUNT_OPTIONS+=("-v" "/run/containers/${UID}/auth.json:/run/containers/0/auth.json")
fi

# We run the container as sudo in order to be able to access the root container
# storage, which has the ilab image pre-pulled. But for security reasons we map
# root UID 0 inside the container to the current user's UID (and all the other
Expand Down
9 changes: 9 additions & 0 deletions training/nvidia-bootc/duplicated/ilab-wrapper/ilab
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ for PODMAN_MOUNT in "${ADDITIONAL_MOUNTS[@]}"; do
ADDITIONAL_MOUNT_OPTIONS+=("-v" "$PODMAN_MOUNT")
done

# Add pull-secret to additional mounts
# In case of normal user, $XDG_RUNTIME_DIR is used
if [[ -f ${XDG_RUNTIME_DIR}/containers/auth.json ]]; then
ADDITIONAL_MOUNT_OPTIONS+=("-v" "${XDG_RUNTIME_DIR}/containers/auth.json:/run/containers/0/auth.json")
# For root the main /run/containers is used
elif [[ -f /run/containers/${UID}/auth.json ]]; then
ADDITIONAL_MOUNT_OPTIONS+=("-v" "/run/containers/${UID}/auth.json:/run/containers/0/auth.json")
fi

# We run the container as sudo in order to be able to access the root container
# storage, which has the ilab image pre-pulled. But for security reasons we map
# root UID 0 inside the container to the current user's UID (and all the other
Expand Down

0 comments on commit cc2447e

Please sign in to comment.