improve docker scripts (#23)

* Feature/support x86 64 (#22)

* [Add] support for x86_64 archtecture.

* make script executable

* [fix] apply shellcheck suggestions (to get rid of warning during runtime)

* [fix] update the image_tag to match the x86 tag

* add input detection as optional, rename scripts

---------

Co-authored-by: Austin Gregg-Smith <blooop@gmail.com>
This commit is contained in:
Balakumar Sundaralingam
2023-11-04 15:51:59 -07:00
committed by GitHub
parent ac02893dee
commit 21d434f608
12 changed files with 201 additions and 65 deletions

25
docker/build_dev_docker.sh Normal file → Executable file
View File

@@ -12,29 +12,42 @@
# This script will create a dev docker. Run this script by calling `bash build_dev_docker.sh`
# If you want to build a isaac sim docker, run this script with `bash build_dev_docker.sh isaac`
# If you want to build a isaac sim docker, run this script with `bash build_dev_docker.sh isaac_sim_2022.2.1`
# Check architecture to build:
arch=`uname -m`
echo "deprecated, use build_docker.sh instead"
image_tag="x86"
isaac_sim_version=""
input_arg="$1"
if [ $1 == "isaac_sim_2022.2.1" ]; then
if [ -z "$input_arg" ]; then
arch=$(uname -m)
echo "Argument empty, trying to build based on architecture"
if [ "$arch" == "x86_64" ]; then
input_arg="x86"
elif [ "$arch" == "arm64" ]; then
input_arg="aarch64"
elif [ "$arch" == "aarch64" ]; then
input_arg="aarch64"
fi
fi
if [ "$input_arg" == "isaac_sim_2022.2.1" ]; then
echo "Building Isaac Sim docker"
dockerfile="isaac_sim.dockerfile"
image_tag="isaac_sim_2022.2.1"
isaac_sim_version="2022.2.1"
elif [ $1 == "isaac_sim_2023.1.0" ]; then
elif [ "$input_arg" == "isaac_sim_2023.1.0" ]; then
echo "Building Isaac Sim headless docker"
dockerfile="isaac_sim.dockerfile"
image_tag="isaac_sim_2023.1.0"
isaac_sim_version="2023.1.0"
elif [ ${arch} == "x86" ]; then
elif [ "$input_arg" == "x86" ]; then
echo "Building for X86 Architecture"
dockerfile="x86.dockerfile"
image_tag="x86"
elif [ ${arch} = "aarch64" ]; then
elif [ "$input_arg" = "aarch64" ]; then
echo "Building for ARM Architecture"
dockerfile="aarch64.dockerfile"
image_tag="aarch64"

73
docker/build_docker.sh Executable file
View File

@@ -0,0 +1,73 @@
#!/bin/bash
##
## Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
##
## NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
## property and proprietary rights in and to this material, related
## documentation and any modifications thereto. Any use, reproduction,
## disclosure or distribution of this material and related documentation
## without an express license agreement from NVIDIA CORPORATION or
## its affiliates is strictly prohibited.
##
# This script will create a dev docker. Run this script by calling `bash build_dev_docker.sh`
# If you want to build a isaac sim docker, run this script with `bash build_dev_docker.sh isaac_sim_2022.2.1`
# Check architecture to build:
image_tag="x86"
isaac_sim_version=""
input_arg="$1"
if [ -z "$input_arg" ]; then
arch=$(uname -m)
echo "Argument empty, trying to build based on architecture"
if [ "$arch" == "x86_64" ]; then
input_arg="x86"
elif [ "$arch" == "arm64" ]; then
input_arg="aarch64"
elif [ "$arch" == "aarch64" ]; then
input_arg="aarch64"
fi
fi
if [ "$input_arg" == "isaac_sim_2022.2.1" ]; then
echo "Building Isaac Sim docker"
dockerfile="isaac_sim.dockerfile"
image_tag="isaac_sim_2022.2.1"
isaac_sim_version="2022.2.1"
elif [ "$input_arg" == "isaac_sim_2023.1.0" ]; then
echo "Building Isaac Sim headless docker"
dockerfile="isaac_sim.dockerfile"
image_tag="isaac_sim_2023.1.0"
isaac_sim_version="2023.1.0"
elif [ "$input_arg" == "x86" ]; then
echo "Building for X86 Architecture"
dockerfile="x86.dockerfile"
image_tag="x86"
elif [ "$input_arg" = "aarch64" ]; then
echo "Building for ARM Architecture"
dockerfile="aarch64.dockerfile"
image_tag="aarch64"
else
echo "Unknown Architecture"
exit
fi
# build docker file:
# Make sure you enable nvidia runtime by:
# Edit/create the /etc/docker/daemon.json with content:
# {
# "runtimes": {
# "nvidia": {
# "path": "/usr/bin/nvidia-container-runtime",
# "runtimeArgs": []
# }
# },
# "default-runtime": "nvidia" # ADD this line (the above lines will already exist in your json file)
# }
#
echo "${dockerfile}"
docker build --build-arg ISAAC_SIM_VERSION=${isaac_sim_version} -t curobo_docker:${image_tag} -f ${dockerfile} .

0
docker/build_user_docker.sh Normal file → Executable file
View File

29
docker/start_dev_docker.sh Normal file → Executable file
View File

@@ -10,8 +10,25 @@
## its affiliates is strictly prohibited.
##
echo "deprecated, use start_user_docker.sh instead"
if [ $1 == "x86" ]; then
input_arg="$1"
if [ -z "$input_arg" ]; then
echo "Argument empty, trying to run based on architecture"
arch=$(uname -m)
if [ "$arch" == "x86_64" ]; then
input_arg="x86"
elif [ "$arch" == "arm64" ]; then
input_arg="aarch64"
elif [ "$arch" == "aarch64" ]; then
input_arg="aarch64"
fi
fi
if [ "$input_arg" == "x86" ]; then
docker run --rm -it \
--privileged \
@@ -25,9 +42,9 @@ if [ $1 == "x86" ]; then
--env DISPLAY=unix$DISPLAY \
--volume /tmp/.X11-unix:/tmp/.X11-unix \
--volume /dev:/dev \
curobo_docker:user_$1
curobo_docker:user_$input_arg
elif [ $1 == "aarch64" ]; then
elif [ "$input_arg" == "aarch64" ]; then
docker run --rm -it \
--runtime nvidia \
@@ -40,10 +57,10 @@ elif [ $1 == "aarch64" ]; then
--volume /tmp/.X11-unix:/tmp/.X11-unix \
--volume /dev/input:/dev/input \
--mount type=bind,src=/home/$USER/code,target=/home/$USER/code \
curobo_docker:user_$1
curobo_docker:user_$input_arg
elif [[ $1 == *isaac_sim* ]] ; then
echo "Isaac Sim Dev Docker is not supported"
elif [[ "$input_arg" == *isaac_sim* ]] ; then
echo "Isaac Sim User Docker is not supported"
else
echo "Unknown docker"
fi

28
docker/start_docker.sh Normal file → Executable file
View File

@@ -10,7 +10,21 @@
## its affiliates is strictly prohibited.
##
if [ $1 == "x86" ]; then
input_arg="$1"
if [ -z "$input_arg" ]; then
echo "Argument empty, trying to run based on architecture"
arch=$(uname -m)
if [ "$arch" == "x86_64" ]; then
input_arg="x86"
elif [ "$arch" == "arm64" ]; then
input_arg="aarch64"
elif [ "$arch" == "aarch64" ]; then
input_arg="aarch64"
fi
fi
if [ "$input_arg" == "x86" ]; then
docker run --rm -it \
--privileged \
@@ -23,9 +37,9 @@ if [ $1 == "x86" ]; then
--env DISPLAY=unix$DISPLAY \
--volume /tmp/.X11-unix:/tmp/.X11-unix \
--volume /dev:/dev \
curobo_docker:$1
curobo_docker:$input_arg
elif [ $1 == "aarch64" ]; then
elif [ "$input_arg" == "aarch64" ]; then
docker run --rm -it \
--runtime nvidia \
@@ -37,11 +51,11 @@ elif [ $1 == "aarch64" ]; then
--env DISPLAY=$DISPLAY \
--volume /tmp/.X11-unix:/tmp/.X11-unix \
--volume /dev/input:/dev/input \
curobo_docker:$1
curobo_docker:$input_arg
elif [[ $1 == *isaac_sim* ]] ; then
elif [[ "$input_arg" == *isaac_sim* ]] ; then
docker run --name container_$1 --entrypoint bash -it --gpus all -e "ACCEPT_EULA=Y" --rm --network=host \
docker run --name container_$input_arg --entrypoint bash -it --gpus all -e "ACCEPT_EULA=Y" --rm --network=host \
--privileged \
-e "PRIVACY_CONSENT=Y" \
-v $HOME/.Xauthority:/root/.Xauthority \
@@ -55,7 +69,7 @@ elif [[ $1 == *isaac_sim* ]] ; then
-v ~/docker/isaac-sim/data:/root/.local/share/ov/data:rw \
-v ~/docker/isaac-sim/documents:/root/Documents:rw \
--volume /dev:/dev \
curobo_docker:$1
curobo_docker:$input_arg
else
echo "Unknown docker"

0
docker/start_docker_aarch64.sh Normal file → Executable file
View File

View File

@@ -1,22 +0,0 @@
##
## Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
##
## NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
## property and proprietary rights in and to this material, related
## documentation and any modifications thereto. Any use, reproduction,
## disclosure or distribution of this material and related documentation
## without an express license agreement from NVIDIA CORPORATION or
## its affiliates is strictly prohibited.
##
docker run --rm -it \
--runtime nvidia \
--mount type=bind,src=/home/$USER/code,target=/home/$USER/code \
--hostname ros1-docker \
--add-host ros1-docker:127.0.0.1 \
--network host \
--gpus all \
--env ROS_HOSTNAME=localhost \
--env DISPLAY=$DISPLAY \
--volume /tmp/.X11-unix:/tmp/.X11-unix \
--volume /dev/input:/dev/input \
curobo_user_docker:latest

0
docker/start_docker_isaac_sim.sh Normal file → Executable file
View File

0
docker/start_docker_isaac_sim_headless.sh Normal file → Executable file
View File

0
docker/start_docker_x86.sh Normal file → Executable file
View File

View File

@@ -1,24 +0,0 @@
##
## Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
##
## NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
## property and proprietary rights in and to this material, related
## documentation and any modifications thereto. Any use, reproduction,
## disclosure or distribution of this material and related documentation
## without an express license agreement from NVIDIA CORPORATION or
## its affiliates is strictly prohibited.
##
docker run --rm -it \
--privileged --mount type=bind,src=/home/$USER/code,target=/home/$USER/code \
-e NVIDIA_DISABLE_REQUIRE=1 \
-e NVIDIA_DRIVER_CAPABILITIES=all --device /dev/dri \
--hostname ros1-docker \
--add-host ros1-docker:127.0.0.1 \
--gpus all \
--network host \
--env ROS_MASTER_URI=http://127.0.0.1:11311 \
--env ROS_IP=127.0.0.1 \
--env DISPLAY=unix$DISPLAY \
--volume /tmp/.X11-unix:/tmp/.X11-unix \
--volume /dev/input:/dev/input \
curobo_user_docker:latest

65
docker/start_user_docker.sh Executable file
View File

@@ -0,0 +1,65 @@
#!/bin/bash
##
## Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
##
## NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
## property and proprietary rights in and to this material, related
## documentation and any modifications thereto. Any use, reproduction,
## disclosure or distribution of this material and related documentation
## without an express license agreement from NVIDIA CORPORATION or
## its affiliates is strictly prohibited.
##
input_arg="$1"
if [ -z "$input_arg" ]; then
echo "Argument empty, trying to run based on architecture"
arch=$(uname -m)
if [ "$arch" == "x86_64" ]; then
input_arg="x86"
elif [ "$arch" == "arm64" ]; then
input_arg="aarch64"
elif [ "$arch" == "aarch64" ]; then
input_arg="aarch64"
fi
fi
if [ "$input_arg" == "x86" ]; then
docker run --rm -it \
--privileged \
-e NVIDIA_DISABLE_REQUIRE=1 \
-e NVIDIA_DRIVER_CAPABILITIES=all --device /dev/dri \
--mount type=bind,src=/home/$USER/code,target=/home/$USER/code \
--hostname ros1-docker \
--add-host ros1-docker:127.0.0.1 \
--gpus all \
--network host \
--env DISPLAY=unix$DISPLAY \
--volume /tmp/.X11-unix:/tmp/.X11-unix \
--volume /dev:/dev \
curobo_docker:user_$1
elif [ "$input_arg" == "aarch64" ]; then
docker run --rm -it \
--runtime nvidia \
--hostname ros1-docker \
--add-host ros1-docker:127.0.0.1 \
--network host \
--gpus all \
--env ROS_HOSTNAME=localhost \
--env DISPLAY=$DISPLAY \
--volume /tmp/.X11-unix:/tmp/.X11-unix \
--volume /dev/input:/dev/input \
--mount type=bind,src=/home/$USER/code,target=/home/$USER/code \
curobo_docker:user_$1
elif [[ "$input_arg" == *isaac_sim* ]] ; then
echo "Isaac Sim User Docker is not supported"
else
echo "Unknown docker"
fi