Skip to content

Commit c0abd7e

Browse files
Fix docker version for latest vs. cuda_gr00t (#112)
## Summary Docker default image name implies :latest as the version tag. It causes ambiguity when expecting gr00t deps to run inside docker with cuda_gr00t version. ## Detailed description - Container is called isaac_arena-latest or isaac_arnea:cuda_gr00t - Specify which container to kill/ exec - Specify its name in docker run Co-authored-by: Vikram Ramasamy <158473438+viiik-inside@users.noreply.github.com>
1 parent 67965fa commit c0abd7e

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

docker/run_docker.sh

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22
set -e
33
DOCKER_IMAGE_NAME='isaac_arena'
4+
DOCKER_VERSION_TAG='latest'
45

56
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
67

@@ -47,6 +48,7 @@ while getopts ":d:m:e:hn:rn:Rn:vn:gn:G:" OPTION; do
4748
;;
4849
g)
4950
INSTALL_GROOT="true"
51+
DOCKER_VERSION_TAG='cuda_gr00t'
5052
;;
5153
G)
5254
GROOT_DEPS_GROUP=${OPTARG}
@@ -86,40 +88,40 @@ done
8688
shift $((OPTIND-1))
8789

8890
# Display the values being used
89-
echo "Using Docker image: $DOCKER_IMAGE_NAME"
91+
echo "Using Docker image: $DOCKER_IMAGE_NAME:$DOCKER_VERSION_TAG"
9092

9193
# Build the Docker image with the specified or default name
9294
echo "Building Docker image with GR00T installation: $INSTALL_GROOT"
9395
if [ "$INSTALL_GROOT" = "true" ]; then
9496
echo "GR00T dependency group: $GROOT_DEPS_GROUP"
9597
fi
9698

97-
if [ "$(docker images -q $DOCKER_IMAGE_NAME 2> /dev/null)" ] && \
99+
if [ "$(docker images -q $DOCKER_IMAGE_NAME:$DOCKER_VERSION_TAG 2> /dev/null)" ] && \
98100
[ "$FORCE_REBUILD" = false ]; then
99-
echo "Docker image $DOCKER_IMAGE_NAME already exists. Not rebuilding."
101+
echo "Docker image $DOCKER_IMAGE_NAME:$DOCKER_VERSION_TAG already exists. Not rebuilding."
100102
echo "Use -r option to force the rebuild."
101103
else
102104
docker build --pull \
103105
$NO_CACHE \
104106
--build-arg WORKDIR="${WORKDIR}" \
105107
--build-arg INSTALL_GROOT=$INSTALL_GROOT \
106108
--build-arg GROOT_DEPS_GROUP=$GROOT_DEPS_GROUP \
107-
-t ${DOCKER_IMAGE_NAME} \
109+
-t ${DOCKER_IMAGE_NAME}:${DOCKER_VERSION_TAG} \
108110
--file $SCRIPT_DIR/Dockerfile.isaac_arena \
109111
$SCRIPT_DIR/..
110112
fi
111113

112114
# Remove any exited containers
113-
if [ "$(docker ps -a --quiet --filter status=exited --filter name=$DOCKER_IMAGE_NAME)" ]; then
114-
docker rm $DOCKER_IMAGE_NAME > /dev/null
115+
if [ "$(docker ps -a --quiet --filter status=exited --filter name=$DOCKER_IMAGE_NAME-$DOCKER_VERSION_TAG)" ]; then
116+
docker rm $DOCKER_IMAGE_NAME-$DOCKER_VERSION_TAG > /dev/null
115117
fi
116118

117119
# If container is running, attach to it, otherwise start
118-
if [ "$( docker container inspect -f '{{.State.Running}}' $DOCKER_IMAGE_NAME 2>/dev/null)" = "true" ]; then
120+
if [ "$( docker container inspect -f '{{.State.Running}}' $DOCKER_IMAGE_NAME'-'$DOCKER_VERSION_TAG 2>/dev/null)" = "true" ]; then
119121
echo "Container already running. Attaching."
120-
docker exec -it $DOCKER_IMAGE_NAME su $(id -un)
122+
docker exec -it $DOCKER_IMAGE_NAME-$DOCKER_VERSION_TAG su $(id -un)
121123
else
122-
DOCKER_RUN_ARGS=("--name" "$DOCKER_IMAGE_NAME"
124+
DOCKER_RUN_ARGS=("--name" "$DOCKER_IMAGE_NAME-$DOCKER_VERSION_TAG"
123125
"--privileged"
124126
"--ulimit" "memlock=-1"
125127
"--ulimit" "stack=-1"
@@ -166,8 +168,12 @@ else
166168
fi
167169
fi
168170

171+
# if gr00t is installed, mount the gr00t directory in case anything needs to change there
172+
if [ "$INSTALL_GROOT" = "true" ]; then
173+
DOCKER_RUN_ARGS+=("-v" "./submodules/Isaac-GR00T:${WORKDIR}/submodules/Isaac-GR00T")
174+
fi
169175
# Allow X11 connections
170176
xhost +local:docker > /dev/null
171177

172-
docker run "${DOCKER_RUN_ARGS[@]}" --interactive --rm --tty ${DOCKER_IMAGE_NAME} "${@}"
178+
docker run "${DOCKER_RUN_ARGS[@]}" --interactive --rm --tty ${DOCKER_IMAGE_NAME}:${DOCKER_VERSION_TAG} "${@}"
173179
fi

0 commit comments

Comments
 (0)