0
0

More than 1 year has passed since last update.

ubuntu18.04でapt-get installするとBad Requestなる場合の対処法

Posted at

概要

遭遇したのはDocker環境なので以下Dockerの話
プロキシが必須の環境で具体的には以下のDockerfileをbuildしようとしたときに発生した

Dockerfile
FROM ubuntu:18.04

RUN apt-get update
RUN apt-get install -y \
    software-properties-common
RUN apt-get install -y \
    python3.8 \
    python3.8-dev \
    python3-pip

で以下のBad Requestを確認

error
55.06 Err:58 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpython3-dev amd64 3.6.7-1~18.04
55.06   400  Bad Request [IP: xxx.xxx....]

78.23 Err:62 http://archive.ubuntu.com/ubuntu bionic/main amd64 manpages-dev all 4.15-1
78.23   400  Bad Request [IP: xxx.xxx....]

解決策

apt-getの代わりにaptでinstallする

今回なら以下のように該当のapt-get installをapt installに置き換えて解決した(事前にapt updateしておくこと)。

RUN apt update
RUN apt-get update
RUN apt-get install -y \
    software-properties-common
RUN apt install -y \
    python3.8 \
    python3.8-dev \
    python3-pip

どうせなら全部aptでインストールしたらよいのでは・・・

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0