我想在ubuntu 18.04.4系统上构建一个docker镜像。
首先,当我执行命令sudo apt-get update
时,它将发生错误
E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/bionic-updates/InRelease is not valid yet (invalid for another 121d 11h 7min 37s). Updates for this repository will not be applied.
然后我将错误的系统时间更改为正确的UTC时间,问题得以解决。
ubuntu@raspi4:~$ sudo apt-get update
Hit:1 http://ports.ubuntu.com/ubuntu-ports bionic InRelease
Hit:2 http://ports.ubuntu.com/ubuntu-ports bionic-updates InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports bionic-backports InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease
Reading package lists... Done
然后我开始构建自己的docker文件使用命令docker build . -t ros-eloquent:test_06_04 -f Dockerfile
,该docker文件的内容如下:
FROM ros:eloquent
ENV HTTP_PROXY "http://${my-proxy-ip:port}/"
ENV HTTPS_PROXY "http://${my-proxy-ip:port}/"
RUN sudo apt-get update && apt-get install -y \
vim \
systemd \
ethtool \
linuxptp \
openssh-server \
ros-eloquent-launch* \
ros-eloquent-rmw-opensplice-cpp \
ros-eloquent-rmw-cyclonedds-cpp
RUN systemctl set-default multi-user.target
......
执行RUN sudo apt-get update && ...
步骤时,错误信息如下:
Step 4/10 : RUN sudo apt-get update && apt-get install -y vim systemd ethtool linuxptp openssh-server ros-eloquent-launch* ros-eloquent-rmw-opensplice-cpp ros-eloquent-rmw-cyclonedds-cpp
---> Running in 42bc7b8f1610
Err:1 http://ports.ubuntu.com/ubuntu-ports bionic InRelease
Could not connect to ports.ubuntu.com:80 (91.189.88.150), connection timed out
Err:2 http://ports.ubuntu.com/ubuntu-ports bionic-updates InRelease
Unable to connect to ports.ubuntu.com:http:
Err:3 http://ports.ubuntu.com/ubuntu-ports bionic-backports InRelease
Unable to connect to ports.ubuntu.com:http:
Err:4 http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease
Unable to connect to ports.ubuntu.com:http:
Err:5 http://packages.ros.org/ros2/ubuntu bionic InRelease
Could not connect to packages.ros.org:80 (140.211.166.134), connection timed out Could not connect to packages.ros.org:80 (64.50.236.52), connection timed out Could not connect to packages.ros.org:80 (64.50.233.100), connection timed out
Reading package lists...
它是有线的,原因是当我仅在终端中执行sudo apt-get update
时,它可以正常工作,但是当我执行docker命令docker build . -t ros-eloquent:test_06_04 -f Dockerfile
时,会发生连接超时错误,有人对此有任何线索吗? ?感激。
PS:同样,当我在终端中执行wget http://ports.ubuntu.com/ubuntu-ports
命令时,它也可以正常接收响应。