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

Support for foreign architecture images #15

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions etc/bases
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,8 @@ d12u ghcr.io/perfsonar/unibuild/d12:latest
u18u ghcr.io/perfsonar/unibuild/u18:latest
u20u ghcr.io/perfsonar/unibuild/u20:latest
u22u ghcr.io/perfsonar/unibuild/u22:latest
# Some foreign architecture images, they need to have full sha256 identifier
d11uarm64 ghcr.io/perfsonar/unibuild/d11:latest@sha256:7b2fcc86008c8c1d2b89703872f2756bcd2f651726256f2777afb88418689f3a
d11uarmhf ghcr.io/perfsonar/unibuild/d11:latest@sha256:d8cbb03c5bd8f88a01abd032725fa3c25e5593ddd7d1664e3f63e44021e5f0d7
d11uppc64 ghcr.io/perfsonar/unibuild/d11:latest@sha256:c712efe4b949cc1f5952a54231cb9ed3bbced94daf82cac6ea49a10b8021cfb0

11 changes: 10 additions & 1 deletion libexec/commands/boot
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ case $(uname -s) in
;;
esac

# Get image platform architecture
PLATFORM=$(do_docker $DOCKER image inspect \
"${IMAGE_FULL}" \
| awk -F \" '/Architecture/ {print $4}' \
)

do_docker $DOCKER run \
--hostname "${NAME}" \
--name "${CONTAINER_NAME}" \
Expand All @@ -114,10 +120,13 @@ do_docker $DOCKER run \
${VOLUME_CGROUP} \
--volume "${USER_HOME}:${USER_HOME}" \
--security-opt label:disable \
"${IMAGE_FULL}:latest" \
--platform "linux/${PLATFORM}" \
"${IMAGE_FULL}" \
bash /ddb-entrypoint --user-ent "${USER_ENT}"

if ${LOGIN_AFTER}
then
# Wait a bit for the container to boot properly
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest that login be modified to spin on docker exec /bin/true being successful for up to, say, 30 seconds, before attempting to run bash. The fixed 2-second interval invites a race condition for other containers that take longer.

sleep 2
exec "${WHEREAMI}/login" "${NAME}"
fi