- Use XQuartz version: XQuartz 2.7.8, else it may have libGL error!
- set XQuartz preferences –> Security –> Tick all connections
- in
/etc/ssh/sshd_config
setx11forwarding
to yes (there are two x11forwarding, all set from no to yes)
The bash scripts used to run docker (after install the docker image)—>
#!/bin/bash
IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
/usr/X11/bin/xhost + $IP &
docker run -e DISPLAY=$IP:0 -v /tmp/.X11-unix:/tmp/.X11-unix -p 7000-7010:7000-7010 -v ~/.cache/Xauthority -v /Users/jerry/Documents/diamond:/opt/lpzrobots -it lpzrobots /bin/bash
#docker run --rm -e DISPLAY=$DISPLAY --net=host -v ~/.cache/Xauthority -v /home/simon/Documents/artificial/projects/diamond/lpzrobots:/opt/lpzrobots -it --name lpzrobots lpzrobots_image /bin/bash
#docker run --rm -e DISPLAY=$DISPLAY --net=host -v ~/.cache/Xauthority -it --name lpzrobots lpzrobots_image /bin/bash
Notice: docker how to transfer folders between container and local:
docker run -v 'your_local_folder':'folder_in_docker'
The dockerfile:
# Last time I build it ubuntu:latest was 18.04.1. File might fail in the future
# if so, update next line to that version
FROM ubuntu:18.04
RUN apt-get -y update && apt-get install -y \
g++ make automake libtool xutils-dev m4 libreadline-dev libgsl0-dev \
libglu-dev libgl1-mesa-dev freeglut3-dev libopenscenegraph-dev \
libqt4-dev libqt4-opengl libqt4-opengl-dev qt4-qmake libqt4-qt3support gnuplot gnuplot-x11 \
libncurses5-dev git firefox
RUN apt-get update
RUN apt-get install -qqy x11-apps
RUN cd /opt; git clone https://github.com/artificialsimon/diamond.git #redo
RUN echo ''\
'# configuration file for lpzrobots (automatically generated!)\n'\
'# # Where to install the simulator and utils\n'\
'PREFIX=/usr/local\n'\
'#\n'\
'# # user or developement installation\n'\
'# # Options:\n'\
'# # DEVEL: only install the utility functions,\n'\
'# # which is useful for development on the simulator\n'\
'# # USER: install also the ode_robots and selforg libaries and include files\n'\
'# # this is recommended for users\n'\
'TYPE=USER\n'\
>>/opt/diamond/Makefile.conf
RUN cd /opt/diamond; make all
RUN echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/issue && cat /etc/motd' \
>> /etc/bash.bashrc \
; echo ""\
"##################################################\n"\
"# lpzrobots install directory: #\n"\
"# /opt/diamond #\n"\
"# #\n"\
"# More information can be found under: #\n"\
"# https://github.com/georgmartius/lpzrobots #\n"\
"##################################################\n"\
>>/etc/motd
RUN echo '\n\
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH'\
>> /root/.bashrc
今天的文章Dockerfile and X11 XQuartz 2.7.8 on Mac分享到此就结束了,感谢您的阅读。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/11124.html