Skip to content

Update Dockerfile for Ubuntu 24.04#2744

Open
alnI3S wants to merge 2 commits intoGenesis-Embodied-AI:mainfrom
alnI3S:docker
Open

Update Dockerfile for Ubuntu 24.04#2744
alnI3S wants to merge 2 commits intoGenesis-Embodied-AI:mainfrom
alnI3S:docker

Conversation

@alnI3S
Copy link
Copy Markdown
Contributor

@alnI3S alnI3S commented Apr 27, 2026

Description

Related Issue

Since Ubuntu 24.04 pip install is no longer supported. One has to create a python virtual environment and activate it or uses the flag --break-system-packages less safer.

Ubuntu 24.04 has default user. To fix that one has to delete the default user and re-create it or using another username.

Motivation and Context

For using newer Ubuntu and Python

How Has This Been / Can This Be Tested?

  • In Genesis root folder, build the docker image with docker build -t genesis:testing -f docker/Dockerfile docker/ or pull it from my docker hub docker pull i3salng/genesis:latest

  • create a source file genesis_ws with this content:

# 1. define env
# 1.1 If your local folders have different names, change `WORKDIR` below.

WORKDIR=`pwd`
SHMSIZE="2gb"
CCACHE_DIR=${HOME}/.ccache
XAUTH=/tmp/.docker.xauth
DOCKER_REPO="i3salng/genesis:latest"
CONTAINER_NAME="genesis"
COMMAND="bash"

# 2. run
# 2.1. specify the source of the connections that we want:
xhost +local:docker

# 2.2. run docker container:
docker run -it --rm --privileged --gpus all \
--shm-size=$SHMSIZE \
--group-add 20 --group-add=audio \
--env=LOCAL_USER_ID="$(id -u)" \
--env=ALSA_CARD=PCH \
--env=CCACHE_DIR="${CCACHE_DIR}" \
-v ${CCACHE_DIR}:${CCACHE_DIR}:rw \
-v /dev/dri:/dev/dri \
-v /tmp/.X11-unix:/tmp/.X11-unix/:rw \
-v $XAUTH:$XAUTH \
-v $WORKDIR:/workspace \
-e DISPLAY=$DISPLAY \
-e NVIDIA_VISIBLE_DEVICES=all \
-e NVIDIA_DRIVER_CAPABILITIES=all \
-e QT_X11_NO_MITSHM=1 \
--net=host \
--name=${CONTAINER_NAME} ${DOCKER_REPO} ${COMMAND}
  • start the container with source <path/to/genesis_ws>
  • test the hello_genesis.py : python examples/tutorials/hello_genesis.py

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 49b77aceba

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread docker/Dockerfile
Comment on lines +129 to +131
if [ -n "$EXISTING_USER" ] && [ "$EXISTING_USER" != "$USER_NAME" ]; then
echo "UID $TARGET_UID already belongs to $EXISTING_USER — removing it"
userdel "$EXISTING_USER" || true
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Handle undeletable UID conflicts before calling usermod

detectUIDConflict suppresses userdel failures with || true, but the script then unconditionally runs usermod -u "$LOCAL_USER_ID" user. If LOCAL_USER_ID belongs to a protected or otherwise undeletable account (e.g., UID 0/root), userdel fails silently, usermod fails because the UID is still taken, and set -e terminates container startup. This makes launches fail for those host/CI UID mappings instead of falling back or emitting a clear controlled error.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As I wrote in my comment, there are 2 solutions: create another username or delete the default user username. I select the former solution for convenient, so removing set -e solves the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant