$D^2$SLAM(d2slam)ubuntu部署经验1:docker in PC

代码仓库:d2slam的github地址
主要参考:其中的docker部分

安装步骤

  1. 首先clone该仓库到本地:
    $ git clone https://github.com/HKUST-Aerial-Robotics/D2SLAM/
    
  2. 安装镜像
    $ cd ./D2SLAM/docker
    $ make pc
    
    ./D2SLAM/docker/makefile文件中得知,本质上是运行以下命令:
    docker build  -t d2slam:pc -f ./Dockerfile ..
    
    所以一旦报错,需要针对处理的是 ./D2SLAM/docker/Dockerfile

需要优先考虑的问题

–2023/11/09更新–
Dockerfile 里面第一行,指定了基础镜像:

FROM nvcr.io/nvidia/tensorrt:22.08-py3

但这个镜像可能与你的GPU不匹配,导致最终出现这样一行:

WARNING: Detected xxx GPU, which is not yet supported in this version of the container

白搞一趟。所以,建议在部署镜像前,先部署一个基础镜像,看看GPU是否支持。
我这边不支持,但是显卡也挺新的,于是更换了新版本一点的基础镜像,最终成功:

FROM nvcr.io/nvidia/tensorrt:22.12-py3

找TensorRT其他镜像的网址如下:

Frameworks Support Matrix

部分问题

1 permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post “http://%2Fvar%2Frun%2Fdocker.sock/v1.24/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=docker%2FDockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&shmsize=0&t=d2slam%3Apc&target=&ulimits=null&version=1”: dial unix /var/run/docker.sock: connect: permission denied

权限不足,改为:

$ sudo make pc

2 E: You don’t have enough free space in /var/cache/apt/archives/.

该目录没有足够的可用空间,解决方法:sudo apt-get clean
如果空间仍然不够,考虑更改docker镜像存储的位置(原来存储在/var/lib/docker/中):

$ sudo systemctl stop docker
$ sudo nano /etc/docker/daemon.json 

然后输入以下内容:

{
	"data-root": "~/docker_image"
}

即存储在 ~/ 中。然后输入:

$ sudo systemctl daemon-reload
$ sudo systemctl start docker
$ sudo docker info

查看docker存储位置,发现已经更改。

3 gpg: no valid OpenPGP data found.

这个问题经常出现,我的解决方法是继续安装,一般不会连续出现2次。否则就重装。
重装的一些命令(其中 ‘xxx’ 为密码,path/to/是自定义路径):

echo "xxx" | sudo -S rm -rf ~/docker_image/
mkdir ~/docker_image/
clear
echo "xxx" | sudo -S systemctl stop docker
sudo systemctl start docker
cd path/to/D2SLAM/docker
sudo make pc

4 Connection Failed

# Install ROS里面一步的时候,报错:

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libg/libgweather/libgweather-3-16_3.36.1-1~ubuntu20.04.1_amd64.deb  Connection failed [IP: 185.125.190.36 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/u/uriparser/liburiparser1_0.9.3-2_amd64.deb  Connection failed [IP: 185.125.190.36 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/o/opencv/libopencv-ts-dev_4.2.0+dfsg-5_amd64.deb  Connection failed [IP: 185.125.190.36 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/q/qttools-opensource-src/libqt5designercomponents5_5.12.8-0ubuntu1_amd64.deb  Connection failed [IP: 185.125.190.36 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/universe/m/mesa/mesa-va-drivers_21.2.6-0ubuntu0.1~20.04.2_amd64.deb  Connection failed [IP: 185.125.190.36 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/p/pyqt5/python3-pyqt5_5.14.1+dfsg-3build1_amd64.deb  Connection failed [IP: 185.125.190.39 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

切换网络,但也会出现问题。最好还是换源,即在新的一行添加:

sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list && \

5 “raw.githubusercontent.com” may be down 或者 time out

ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.

参考方法
但是IP地址有误,可能过时了,需要自行查询进行验证。查询网址为:IP地址查询工具
Dockerfile 里面的修改:

  1. 找到
    rosdep init && \
    
  2. 添加以下内容到这句话的上方:
    echo "185.199.110.133 raw.githubusercontent.com" >> /etc/hosts && \
    

实际上,问题并没有解决,第6个问题出现了…

6 The read operation timed out

这是 rosdep 的问题,我就算科学上网也解决不了,因为这个也不是很有必要,就把

rosdep init
rosdep update

删(注释)掉了。

–2023-11-07更新–
重装的时候决定再试试,4的修改+科学上网,看看行不行,果然可行。给出修改:
主要是添加怎么在构建docker镜像时科学上网,详细的说不得太多。查查以下这2个:

ARG https_proxy=
ARG http_proxy=

如果后面 git clone 有问题,就补上:

ARG https_proxy=""
ARG http_proxy=""

7 GnuTLS recv error (-54): Error in the pull function.

出现在git clone的时候。意思是无法从github上下载,重来几次或者科学上网。

8 socket.timeout: The read operation timed out

安装 taichi 部分的时候包的错,大概是安装超时了,修改时间也不好使,于是还是要换源(Python)。
解决方法:找到 Dockerfile 中的 #Install taichi,然后在 pip install 后添加镜像地址(这里是清华源),即:

RUN    pip install -i https://pypi.tuna.tsinghua.edu.cn/simple taichi transformations numpy lcm matplotlib scipy && apt install ros-${ROS_VERSION}-ros-numpy

参考方法

完事!!!
最后引用知乎上一个问题:“计算机科学领域有什么笑话”下的一个回答:“We note that Chinese developers usually have a good understanding of the network.”
若有帮助,还望点一个小小的赞,不胜感激。

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值