当前位置: 代码迷 >> 综合 >> Docker安装ros(ubuntu18.04)(未完待续)
  详细解决方案

Docker安装ros(ubuntu18.04)(未完待续)

热度:72   发布时间:2023-10-16 17:38:08.0

基础镜像为:nvidia/cuda10.0-devel-ubuntu18.04
ros官方安装melodic
Dockerfile:

From nvidia/cuda:10.0-devel-ubuntu18.04 
#-m 自动创建用户的家目录
#-s 指定用户登入后所使用的shell
RUN useradd -ms /bin/bash zty
#修改软件源
RUN sed -i 's/archive.ubuntu/mirrors.aliyun/g' /etc/apt/sources.list
RUN echo 'deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 /' > /etc/apt/sources.list.d/cuda.list
RUN apt-get update
#指定工作目录
WORKDIR /home/ztyFrom faw_project/base_devel:v1.0
#使用清华源
Run sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'

报错: sh: 1: lsb_release: not found
解决办法:

Run sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'

改成

RUN sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ bionic main" > /etc/apt/sources.list.d/ros-latest.list'

增加以下指令:

RUN apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
RUN apt update
RUN apt install ros-melodic-desktop-full

报错:

Do you want to continue? [Y/n] Abort.
The command '/bin/sh -c apt install ros-melodic-desktop-full' returned a non-zero code: 1

解决办法:
docker build中默认不会回答yes或者no
可以通过-y指定

RUN apt install -y ros-melodic-desktop-full

报错:

E: Failed to fetch http://mirrors.aliyun.com/ubuntu/pool/main/t/tcl8.6/libtcl8.6_8.6.8+dfsg-3_amd64.deb  Undetermined Error [IP: 222.75.63.248 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

解决办法:

  相关解决方案