Some weeks ago, I faced the following error with “RUN apt-get update” when I try to build my Docker image based on ROS official Docker image.
W: GPG error: http://snapshots.ros.org/foxy/final/ubuntu focal InRelease: The following signatures were invalid: EXPKEYSIG AD19BAB3CBF125EA ROS Spanshot builder <rosbuild@ros.org>
E: The repository 'http://snapshots.ros.org/foxy/final/ubuntu focal InRelease' is not signed.
It takes some times to resolve it. So, I note the method.
I faced kind of same error with ROS 2 Foxy and ROS Melodic.
ROS 2 Foxy
FROM ros:foxy
ENV DEBIAN_FRONTEND noninteractive
# start
RUN rm /etc/apt/sources.list.d/ros2-snapshots.list
RUN apt-get update && apt-get install -y curl
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
# end
RUN apt-get clean && apt-get update && apt-get install -y wget
I found the way from the following ROS Discourse’s thread.
ROS Melodic
FROM ros:melodic
ENV DEBIAN_FRONTEND noninteractive
# start
RUN rm /etc/apt/sources.list.d/ros1-snapshots.list
RUN apt-get update && apt-get install -y curl
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros1.list > /dev/null
# end
RUN apt-get clean && apt-get update && apt-get install -y wget
When I try with ROS Melodic, I thought there are some small differences between ROS 2 Foxy’s method and ROS Melodic one. But, looks only few tiny differences now.
I couldn’t find any thread about ROS Melodic. Maybe because of EOL.