1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

docker compose up --build でexit code: 100

Posted at

こちらの記事を参考にPythonのDocker環境を作成しようとしたところ、docker compose up -d --buildで以下のエラーが発生した。
先に書いておくと、参考記事の内容を正しく踏襲すれば何も問題はなかったので、参考記事には問題はない。

 => ERROR [3/7] RUN apt-get -y install locals && localdef -f UTF-8 -i ja_JP ja_JP.UTF-8                                                                                   0.6s
------
 > [3/7] RUN apt-get -y install locals && localdef -f UTF-8 -i ja_JP ja_JP.UTF-8:
#6 0.174 Reading package lists...
#6 0.472 Building dependency tree...
#6 0.559 Reading state information...
#6 0.624 E: Unable to locate package locals
------
failed to solve: executor failed running [/bin/sh -c apt-get -y install locals && localdef -f UTF-8 -i ja_JP ja_JP.UTF-8]: exit code: 100

ファイルの内容は以下の通り。

Dockerfile

FROM python:3.9
USER root

RUN apt-get update
RUN apt-get -y install locals && \
    localdef \
    -f UTF-8 \
    -i ja_JP \
    ja_JP.UTF-8

ENV LANG ja_JP.UTF-8
ENV LANGUAGE ja_JP:ja_JP
ENV LC_ALL ja_JP.UTF-8
ENV TZ JST-9
ENV TERM xterm

RUN apt-get install -y vim less

RUN pip install --upgrade pip
RUN pip install --upgrade setuptools

RUN pip install jupyterlab

docker-compose.yml

version: '3'
services:
  python3:
    restart: always
    build: .
    container_name: 'python3'
    working_dir: '/root/'
    tty: true
    volumes:
      - ./opt:/root/opt

解決方法

先に結論から書くと、Dockerfileの該当行に誤字があった。
該当行は日本語ロケールの設定を行う部分だが、localeではなくlocalと記述しているのが問題だった。
exit code: 100 で問題が起きた場合に、誤字がないかの確認を気をつけたい。

誤:

RUN apt-get -y install locals && \
    localdef \
    -f UTF-8 \
    -i ja_JP \
    ja_JP.UTF-8

正:

RUN apt-get -y install locales && \
    localedef \
    -f UTF-8 \
    -i ja_JP \
    ja_JP.UTF-8

その他試したこと

誤字に気づくまでに試したことを備忘録的に列挙する。

Dockerのディスク容量の削除

以下の記事を参考にDockerのディスク容量の削除をおこなった。
GUIでの操作がわかりやすくておすすめ。

CPUのアーキテクチャの確認

こちらの記事によると、どうもM1Macで使用されているARMのCPUではDockerのimageが用意されてないことがあるらしい。

自分の環境はM1 Macを使用してるため、以下のコマンドでCPUのアーキテクチャを確認した。

% uname -m
x86_64

しかし、Intel系のx86_64とのことなので問題はなかった。(以前いじった覚えがある)

1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?