Skip to content

Commit

Permalink
Add docker container script
Browse files Browse the repository at this point in the history
  • Loading branch information
Taeyoung96 committed Jul 27, 2023
1 parent 8ea5b95 commit 4a27bd8
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions docker/container_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
# Author : Taeyoung Kim (https://github.com/Taeyoung96)

# Set the project directory (PROJECT_DIR) as the parent directory of the current working directory
PROJECT_DIR=$(dirname "$PWD")

# Move to the parent folder of the project directory
cd "$PROJECT_DIR"

# Print the current working directory to verify the change
echo "Current working directory: $PROJECT_DIR"

# Check if arguments are provided for the image name and tag
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <container_name> <image_name:tag>"
exit 1
fi

# Assign the arguments to variables for clarity
CONTAINER_NAME="$1"
IMAGE_NAME="$2"

# Launch the nvidia-docker container with the provided image name and tag
nvidia-docker run --privileged -it \
-e NVIDIA_DRIVER_CAPABILITIES=all \
-e NVIDIA_VISIBLE_DEVICES=all \
--volume="$PROJECT_DIR:/root/ros2_ws/src" \
--volume=/data/LIDAR_dataset:/root/data \
--volume=/tmp/.X11-unix:/tmp/.X11-unix:rw \
--net=host \
--ipc=host \
--shm-size=4gb \
--name="$CONTAINER_NAME" \
--env="DISPLAY=$DISPLAY" \
"$IMAGE_NAME" /bin/bash

0 comments on commit 4a27bd8

Please sign in to comment.