我正在尝试将较新的 gcc 工具链添加到我的 docker 镜像中(基于ubuntu:20.04
)。我按照以下步骤操作本文.
在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
我理解了已发布软件包列表尽管提及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
我的docker文件:
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
我是否遗漏了什么?