-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathros-podman.sh
83 lines (63 loc) · 2.06 KB
/
ros-podman.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env sh
## pull docker image
# podman pull docker.io/ros:noetic
podman pull docker.io/osrf/ros:noetic-desktop-full
## list images
podman image ls -a
## build image in the dockerfile directory
## https://github.com/onetruffle/ros-dockerfile
podman build --rm -t my-ros .
## run image as container
# podman run -it ros:noetic-desktop-full
podman run -it image1
## run image with gui and networking, remove after exiting
## https://major.io/2021/10/17/run-xorg-applications-with-podman/
podman run -it -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix image1
## --net=host breaks the network config, gives same hostname as host
## --rm for single use
## x access for all users
xhost + ## unblock
xhost - ## block
## x access for non-network local users
xhost +"local:" ## unblock
xhost -"local:" ## block
## x access for podman
xhost +"local:podman@" ## unblock
xhost -"local:podman@" ## block
## list containers (including the stopped ones)
podman container list --all
## single shell
podman container start -ail
podman container stop -l
## multiple shell sessions
podman container restart -l
podman container exec -til -w /root bash
podman container stop -l
################################
## optional, not necessary
## pause container (
## doesn't work for us, simply freezes the terminal,
## container is destroyed anyway when the terminal
## is killed)
podman container pause _TAB_container-name
## checkpoint and restore container
podman container checkpoint _TAB_container-name
podman container restore _TAB_container-name
## save container as image (not necessary)
podman container commit _TAB_container-name
##############################
## on the container
## source the ros setup script for every new shell
. /opt/ros/noetic/setup.bash
## set the catkin workspace only once
cd ## pushd only works here in zsh, not bash
mkdir -p catkin_ws/src
pushd catkin_ws
catkin_make
popd
## once for every shell
. ~/catkin_ws/devel/setup.bash
## optionally append the setup scripts to ~/.bashrc
echo "
. /opt/ros/noetic/setup.bash
. ~/catkin_ws/devel/setup.bash" >> ~/.bashrc