本人小白一个,为了简单使用镜像,简化操作,参考泡泡机器人基础上,搞了一些操作,欢迎大佬来指出错误,优化方案,也可以提需求哈哈哈。
构建docker镜像,环境包括:ros-melodic,vnc,ssh还有一些库
链接:https://github.com/lishuwei0424/ros-melodic-docker
安装docker
ubuntu参考:https://docs.docker.com/engine/install/ubuntu/
下载准备
git clone https://github.com/lishuwei0424/ros-melodic-docker
形成构建镜像的dockerfile:
FROM dorowu/ubuntu-desktop-lxde-vnc:bionic
WORKDIR /root
RUN apt-get purge dirmngr -y \
&& apt-get update \
&& apt-get install dirmngr -y
#ros-melodic-desktop-full
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' \
&& apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 \
&& apt-get update \
&& apt-get install -y ros-melodic-desktop-full \
&& echo "source /opt/ros/melodic/setup.bash" >>/root/.bashrc \
&& /bin/bash -c "source /root/.bashrc" \
#&& apt install -y python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential \
#&& rosdep init && rosdep update \
&& apt-get autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p ./catkin_ws/src
方便构建和清理镜像,写成makefile:
help:
@echo " make build - build all images"
@echo " make clean - remove all images"
build:
@docker build -t loam:melodic -f Dockerfile .
clean:
@docker rmi -f loam:melodic
运行脚本run_image.sh:
docker run -it --rm \
-v /home/lishuwei/catkin_ws/src/LOAM_NOTED-master/src/:/root/catkin_ws/src/ \
-w /root/catkin_ws/src \
-p 5900:5900 \
-p 6800:80 \
loam:melodic
构建生成
切换到docker目录下:
-
帮助
make help
-
生产镜像
make build
-
将del镜像
make clean
运行容器
sudo chmod +x run_image.sh
./run_image.sh
界面使用
我使用的是Remmina,也可以vnc,如果没有就安装
使用浏览器
可能错误
1.got ‘NOSPLIT’ (does the network require authentication?)
可以更换一下网络
参考资料
1.https://www.yuque.com/grep/kubernetes/xpksoq
2.https://github.com/PaoPaoRobot/docker-ubuntu-xfce-vnc-desktop
3.https://www.bilibili.com/video/BV1uK4y1k7Q1?from=search&seid=4055458955261017336
4.https://github.com/fbottarel/docker-ros-desktop-full