You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

基于Ubuntu 20.04的Docker镜像添加ubuntu-toolchain-r PPA后无法安装gcc-13与g++-13的问题求助

基于Ubuntu 20.04的Docker镜像添加ubuntu-toolchain-r PPA后无法安装gcc-13与g++-13的问题求助

我正在尝试给基于Ubuntu 20.04的Docker镜像添加新版gcc工具链,按步骤操作后碰到了问题,想请大家帮忙排查下。

我先在Docker的bash里执行了这两个命令:

add-apt-repository ppa:ubuntu-toolchain-r/ppa
apt update

但当我尝试安装gcc-13和g++-13时,却收到了找不到包的错误提示:

E: Unable to locate package gcc-13
E: Unable to locate package g++13

我确认过这个PPA的发布包列表里是包含gcc-13的,下面是完整的控制台操作输出:

root@c8f34012b930:/app# add-apt-repository ppa:ubuntu-toolchain-r/ppa -y

Get:1 http://ppa.launchpad.net/ubuntu-toolchain-r/ppa/ubuntu focal InRelease [23.8 kB]
Hit:2 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease
Get:4 http://ppa.launchpad.net/ubuntu-toolchain-r/ppa/ubuntu focal/main amd64 Packages [51.5 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Hit:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Fetched 189 kB in 1s (188 kB/s)
Reading package lists... Done

root@c8f34012b930:/app# apt update

Hit:1 http://ppa.launchpad.net/ubuntu-toolchain-r/ppa/ubuntu focal InRelease
Hit:2 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.

root@c8f34012b930:/app# apt install gcc-13 g++-13

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package gcc-13
E: Unable to locate package g++-13

以下是我使用的Dockerfile内容:

FROM ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive

# Install SSH server
RUN apt-get update && apt-get install -y openssh-server

# Configure SSH
RUN mkdir /var/run/sshd
RUN echo 'root:youcantseeme' | chpasswd
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config

EXPOSE 22

# C++ dev tools & libs
RUN apt-get update && \
apt-get install -y software-properties-common && \
apt-get install -y build-essential gcc gdb gdbserver ninja-build cmake \
libasio-dev libssl-dev libgtest-dev python3 python3-pip && \
apt-get clean && \
pip install pytest

WORKDIR /app

VOLUME /app/build
VOLUME /app/install

# Start SSH server
ENTRYPOINT service ssh restart && bash

我是不是漏掉了什么关键步骤?麻烦大家帮忙分析一下,谢谢!

备注:内容来源于stack exchange,提问作者Sergey Kolesnik

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.21 10:23:05