0
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】docker-compose up -dを行うと「tar: command not found」と表示されてしまった場合の対処法

Posted at

概要

  • docker-compose up -dを行うと「tar: command not found」「failed to solve: executor failed running...」というエラーが出て正常にビルドが完了しませんでした。今回はその解決方法を記します。

エラー内容

  • docker-compose up -dを行うと以下のエラがー表示されました。pyenvがPython-3.7.6をダウンロードしている途中で失敗してしまいました。
# (省略)
#0 7.239 /usr/local/pyenv/plugins/python-build/bin/python-build: line 456: tar: command not found
------
failed to solve: executor failed running [/bin/bash -c pyenv install -v 3.7.6 && pyenv global 3.7.6 && pip install awscli]: exit code: 1

解決手順

  • pyenv指定でインストールしてみたり、bashrcをいじってみたり試行錯誤しましたが、結論、Dockerfileに以下を追加したら解決しました。
RUN yum install -y tar
  • そもそも「tar: command not found」と出ていた理由は何かというと、Dockerfileに以下のように記載があったためです。
RUN yum install -y gcc bzip2 bzip2-devel openssl openssl-devel readline
readline-devel git libffi-devel wget gcc-c++ unixODBC-devel tar.x86_64
  • このtar.x86_64がうまくインストールされなかった理由は、自分のローカルマシンがM1チップを搭載しているためです。M1チップは、Intelベースのアプリケーションと互換性がないため、x86_64アーキテクチャのパッケージをインストールすることができなかったのです。
  • ということで、DockerイメージのベースイメージがIntelまたはARMアーキテクチャに基づいているかどうか、とても大事であることを感じたエラー体験でした。
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?