Skip to content

Commit

Permalink
fix: macos oob support (#14)
Browse files Browse the repository at this point in the history
* fix: macos oob support

Signed-off-by: Gabriele Baldoni <[email protected]>

* fix: using env variable for ports

Signed-off-by: Gabriele Baldoni <[email protected]>

---------

Signed-off-by: Gabriele Baldoni <[email protected]>
  • Loading branch information
gabrik authored Jan 16, 2025
1 parent 0ccbaa8 commit 7d79412
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
26 changes: 20 additions & 6 deletions docker/create_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ IMAGE=${IMAGE:-zettascaletech/roscon2024_workshop}
# Docker container name
CONTAINER_NAME=${CONTAINER_NAME:-roscon2024_workshop}

# Zenoh exposed port
EXPOSED_PORT=${EXPOSED_PORT:-7447}

# Get absolute path to base directory (roscon2024_workshop/ dir)
BASE_DIR=$(cd "$(dirname "$0")/.." && pwd)

Expand All @@ -17,10 +20,21 @@ else
# - the display redirection to the host's display
# - the use of host networking
# - a volume mounting host's roscon2024_workshop/zenoh_confs/ to /ros_ws/zenoh_confs
docker run -it --init -d \
--name "$CONTAINER_NAME" \
--net host \
-v "$BASE_DIR/zenoh_confs:/ros_ws/zenoh_confs" \
-e DISPLAY=host.docker.internal:0 \
"$IMAGE"
if [[ "$OSTYPE" == "darwin"* ]]; then
# Mac OSX
docker run -it --init -d \
--name "$CONTAINER_NAME" \
-v "$BASE_DIR/zenoh_confs:/ros_ws/zenoh_confs" \
-e DISPLAY=host.docker.internal:0 \
-p $EXPOSED_PORT:$EXPOSED_PORT/tcp \
-p $EXPOSED_PORT:$EXPOSED_PORT/udp \
"$IMAGE"
else
docker run -it --init -d \
--name "$CONTAINER_NAME" \
--net host \
-v "$BASE_DIR/zenoh_confs:/ros_ws/zenoh_confs" \
-e DISPLAY=host.docker.internal:0 \
"$IMAGE"
fi
fi
5 changes: 5 additions & 0 deletions exercises/ex-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,13 @@ Experiment with different connection topologies, such as forming a chain of conn

If you want to run another container using `rmw_zenoh` on the same host, set the `CONTAINER_NAME` environment variable to a different name (in all terminals):

> [!WARNING]
> If your host runs **MacOS**, you need also to set the `EXPOSED_PORT` environment variable to a different port number (in all terminals):


```bash
export CONTAINER_NAME="container_2"
export EXPOSED_PORT="7448" # for macOS users only
./docker/create_container.sh
./docker/login_container.sh
```
Expand Down

0 comments on commit 7d79412

Please sign in to comment.