Skip to content

Commit

Permalink
RHELAI-787: Mount auth.json into ilab container
Browse files Browse the repository at this point in the history
Signed-off-by: Javi Polo <[email protected]>
  • Loading branch information
javipolo committed Aug 5, 2024
1 parent 701564e commit 20d7d9a
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 20d7d9a

Please sign in to comment.