执行`sudo apt-get update`命令时无法连接到 ports.ubuntu.com:80

问题描述 投票:0回答:1

我想在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 build . -t ros-eloquent:test_06_04 -f Dockerfile
构建自己的docker文件,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
命令时,它可以正常接收响应。

docker dockerfile ubuntu-18.04 http-proxy apt
1个回答
0
投票

无法连接到 ports.ubuntu.com,可能是文件系统已损坏,我在我的香蕉 pi 上遇到了类似的问题,我有 16 LTS 并且想要升级,但我遇到了类似的错误,通过以下方式解决此问题 在 Linux 根分区上运行 fsck。

© www.soinside.com 2019 - 2024. All rights reserved.