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 3 years have passed since last update.

Laradockでpython pipが実行できなくてsupervisorがインストールできないときの解決法

Last updated at Posted at 2021-05-21

はじめに

Laradockでsupervisorをインストールしようとして少しつまったので、
解決策をメモ代わりに記事にしておきます。
エラーの詳細やLaradockについては割愛します。

本文

Laradockのドキュメントにsupervisorのインストール方法が記載されています。

ドキュメントには以下のように環境設定ファイルを編集してね、とあるので
そのとおりにします。

.env(該当箇所以外は省略)
WORKSPACE_INSTALL_PYTHON=true
WORKSPACE_INSTALL_SUPERVISOR=true

そして、コンテナを立ち上げます。

docker compose up -d workspace

すると、

ターミナル
 => ERROR [ 78/110] RUN if [ true = true ]; then   apt-get -y install python python-pip python-dev build-essential    && python -m pip in  1.8s
------
 > [ 78/110] RUN if [ true = true ]; then   apt-get -y install python python-pip python-dev build-essential    && python -m pip install --upgrade pip    && python -m pip install --upgrade virtualenv ;fi:
# 82 0.412 Reading package lists...
# 82 1.378 Building dependency tree...
# 82 1.580 Reading state information...
# 82 1.617 Package python-pip is not available, but is referred to by another package.
# 82 1.617 This may mean that the package is missing, has been obsoleted, or
# 82 1.617 is only available from another source
# 82 1.617 However the following packages replace it:
# 82 1.617   python3-pip
# 82 1.617 
# 82 1.733 E: Package 'python-pip' has no installation candidate

なぜかエラーが...。
よく詳しくはよく分かりませんが、python pipが使えないので
かわりにpython3 pipを使ってねって感じだと思います。

とりあえずsupervisorさえインストールできればいいので、おとなしくpython3を使うことにします。
.envファイルを下記のように修正します。

.env(該当箇所以外は省略)
WORKSPACE_INSTALL_PYTHON=false
WORKSPACE_INSTALL_PYTHON3=true
WORKSPACE_INSTALL_SUPERVISOR=true

また、laradock/workspace/Dockerfileを下記のように修正します。

laradock/workspace/Dockerfile(該当箇所以外は省略)
ARG INSTALL_SUPERVISOR=false

RUN if [ ${INSTALL_SUPERVISOR} = true ]; then \
    # INSTALL_PYTHONをINSTALL_PYTHON3に変更
    if [ ${INSTALL_PYTHON3} = true ]; then \
    # pythonからpython3に変更
    python3 -m pip install --upgrade supervisor && \
    echo_supervisord_conf > /etc/supervisord.conf && \
    sed -i 's/\;\[include\]/\[include\]/g' /etc/supervisord.conf && \
    sed -i 's/\;files\s.*/files = supervisord.d\/*.conf/g' /etc/supervisord.conf \
  ;fi \
;fi

USER laradock

もう一度コンテナを立ち上げます。

docker compose up --build -d workspace

これで無事コンテナが立ち上がるはずです。

めでたし、めでたし。

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?