Skip to content
Snippets Groups Projects
Commit d0327b45 authored by awerner's avatar awerner
Browse files

first version for podman

parent 04f06109
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,6 @@ push:
docker push git.uwaterloo.ca:5050/robohub/turtlebot4:latest
image:
docker pull ubuntu:jammy
docker build --network=host -t git.uwaterloo.ca:5050/robohub/turtlebot4:latest ${CURDIR}
podman pull ubuntu:jammy
podman build --network=host -t git.uwaterloo.ca:5050/robohub/turtlebot4:latest ${CURDIR}
......@@ -46,7 +46,7 @@ for file in /dev/video*; do
done
# allow graphics card access
for file in /dev/dri/*; do
chmod a+rwx $file
chmod a+rwx $file || echo "Failed to set permissions on $file"
done
# show ip address on stdout
......
ROBOTNAME=turtlebot
DOCKER_ROBOT_FLAGS="--ulimit rtprio=99:99 --ulimit memlock=102400:102400"
DOCKER_ROBOT_FLAGS=""
if [ -e /dev/input/spacemouse ]; then
DOCKER_ROBOT_FLAGS="$DOCKER_ROBOT_FLAGS --device /dev/input/spacemouse"
......
......@@ -41,23 +41,15 @@ fi
# Settings required for having nvidia GPU acceleration inside the docker
DOCKER_X11_ARGS="--env DISPLAY --ipc=host --volume=/tmp/.X11-unix:/tmp/.X11-unix:rw"
which nvidia-docker > /dev/null 2> /dev/null
HAS_NVIDIA_DOCKER=$?
if [ $HAS_NVIDIA_DOCKER -eq 0 ]; then
DOCKER_COMMAND=nvidia-docker
DOCKER_GPU_ARGS="$DOCKER_GPU_ARGS --env NVIDIA_VISIBLE_DEVICES=all --env NVIDIA_DRIVER_CAPABILITIES=all"
else
#echo "Running without nvidia-docker, if you have an NVidia card you may need it"\
#"to have GPU acceleration"
DOCKER_COMMAND=docker
fi
DOCKER_COMMAND=podman
DOCKER_GPU_ARGS="$DOCKER_GPU_ARGS --device=nvidia.com/gpu=all --security-opt=label=disable"
xhost +
#ADDITIONAL_FLAGS="--detach"
ADDITIONAL_FLAGS="--rm --interactive --tty"
ADDITIONAL_FLAGS="$ADDITIONAL_FLAGS --device /dev/dri:/dev/dri --volume=/run/udev:/run/udev"
ADDITIONAL_FLAGS="$ADDITIONAL_FLAGS --volume=/run/udev:/run/udev"
# forward joystick/spacemouse input device
if [ -e /dev/input/js0 ]; then
......@@ -90,15 +82,6 @@ if [ -z "${CONTAINER_NAME}" ]; then
CONTAINER_NAME=uw_${ROBOTNAME}_${USER}
fi
docker network ls | grep -q ${CONTAINER_NAME} || docker network create ${CONTAINER_NAME}
if [ -f /run/NetworkManager/resolv.conf ]; then
DOCKER_DNS_ARGS="--dns=$(cat /run/NetworkManager/resolv.conf | grep nameserver | sed -s "s/nameserver //" | head -n 1) "
elif [ -f /run/resolvconf/resolv.conf ]; then
DOCKER_DNS_ARGS="--dns=$(cat /run/resolvconf/resolv.conf | grep nameserver | sed -s "s/nameserver //" | head -n 1) "
else
DOCKER_DNS_ARGS="--dns=8.8.8.8"
fi
if ! docker container ps | grep -q ${CONTAINER_NAME}; then
echo "Starting new container with name: ${CONTAINER_NAME}"
$DOCKER_COMMAND run \
......@@ -114,8 +97,8 @@ if ! docker container ps | grep -q ${CONTAINER_NAME}; then
--cap-add=NET_ADMIN \
--device /dev/bus/usb \
--device /dev/net \
--network=slirp4netns \
$DOCKER_DNS_ARGS \
--network ${CONTAINER_NAME} \
$IMAGE_NAME
else
echo "Starting shell in running container"
......
......@@ -5,7 +5,6 @@ if [ -z "$1" ]; then
exit 1
fi
set -e
ping -c 1 -w 10 robohub.eng.uwaterloo.ca > /dev/null || (echo -e "\e[31mCould not ping srv, check your network connections\e[39m"; exit 1)
echo "Remote reachable"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
......@@ -36,6 +35,6 @@ function cleanup()
trap "cleanup" SIGINT SIGTERM
echo "Enter your UW credentials next"
chmod go-rwx client.key
sudo chmod go-rwx client.key
sudo LD_LIBRARY_PATH=${LD_LIBRARY_PATH} $(which openvpn) --config turtlebot-tap.conf --setenv SETTINGS $tmpfile
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment