どうもてぃ。
前回の記事でgcloudコマンドをPython3.8に対応させました。
今回の問題は、GCRへイメージをpushするためgcloud auth configure-docker
で認証を行った後に起こったことです。
調査から解決まで一連の流れを書いていこうと思います。
環境
言語関係のバージョン管理はasdf
を使用しています。
% cat /etc/lsb-release DISTRIB_ID=LinuxMint DISTRIB_RELEASE=19.3 DISTRIB_CODENAME=tricia DISTRIB_DESCRIPTION="Linux Mint 19.3 Tricia" % docker-compose -v docker-compose version 1.27.4, build 40524192 % docker -v Docker version 19.03.6, build 369ce74a3c
エラー内容
% docker-compose build postgres uses an image, skipping redis uses an image, skipping Building web ERROR: gcloud failed to load: /tmp/_MEIKPCrAH/libssl.so.1.1: version `OPENSSL_1_1_1' not found (required by /home/motty/.asdf/installs/python/3.8.1/lib/python3.8/lib-dynload/_ssl.cpython-38-x86_64-linux-gnu.so) gcloud_main = _import_gcloud_main() import googlecloudsdk.gcloud_main from googlecloudsdk.api_lib.iamcredentials import util as iamcred_util from googlecloudsdk.api_lib.util import apis_internal from googlecloudsdk.core import properties from googlecloudsdk.core import config from oauth2client import client from oauth2client import transport import httplib2 from httplib2.python3.httplib2 import * import ssl import _ssl # if we can't import it, let the error propagate This usually indicates corruption in your gcloud installation or problems with your Python interpreter. Please verify that the following is the path to a working Python 2.7 or 3.5+ executable: /home/motty/.asdf/installs/python/3.8.1/bin/python3 If it is not, please set the CLOUDSDK_PYTHON environment variable to point to a working Python 2.7 or 3.5+ executable. If you are still experiencing problems, please reinstall the Cloud SDK using the instructions here: https://cloud.google.com/sdk/ Traceback (most recent call last): File "docker/credentials/store.py", line 80, in _execute File "subprocess.py", line 411, in check_output File "subprocess.py", line 512, in run subprocess.CalledProcessError: Command '['/usr/bin/docker-credential-gcloud', 'get']' returned non-zero exit status 1. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "docker/auth.py", line 264, in _resolve_authconfig_credstore File "docker/credentials/store.py", line 35, in get File "docker/credentials/store.py", line 93, in _execute docker.credentials.errors.StoreError: Credentials store docker-credential-gcloud exited with "". During handling of the above exception, another exception occurred: Traceback (most recent call last): File "bin/docker-compose", line 3, in <module> File "compose/cli/main.py", line 67, in main File "compose/cli/main.py", line 126, in perform_command File "compose/cli/main.py", line 302, in build File "compose/project.py", line 468, in build File "compose/project.py", line 450, in build_service File "compose/service.py", line 1125, in build File "docker/api/build.py", line 261, in build File "docker/api/build.py", line 308, in _set_auth_headers File "docker/auth.py", line 311, in get_all_credentials File "docker/auth.py", line 281, in _resolve_authconfig_credstore docker.errors.DockerException: Credentials store error: StoreError('Credentials store docker-credential-gcloud exited with "".') [29221] Failed to execute script docker-compose
暫定的な解決策
GCRへイメージをあげるのはある程度期間が空くため、暫定的にgcloud auth configure-docker
した際$HOME/.docker/config.json
に追記される部分を削除すればdocker buildは上手く行きます。
・ ・ ・ }, "HttpHeaders": { "User-Agent": "Docker-Client/19.03.6 (linux)" }, "credHelpers": { "gcr.io": "gcloud", "us.gcr.io": "gcloud", "eu.gcr.io": "gcloud", "asia.gcr.io": "gcloud", "staging-k8s.gcr.io": "gcloud", "marketplace.gcr.io": "gcloud" } }
credHelpers
部分を削除します。これで一時的に解決できます。
この部分はgcloud auth configure-docker
を実行すれば再度同じものが追記されるので安心して下さい。
根本的な解決策
おそらくOSXやwindowsユーザーは起きてないのではないかと思います。
自分の環境がUbuntuのため同じような現象に悩む人がいたようです。issueがありました。
要約すると...
この三点です。
手順を下に記載します。
% sudo apt install google-cloud-sdk=297.0.1-0 % which python # => /home/motty/.asdf/shims/python % export CLOUDSDK_PYTHON=/home/motty/.asdf/shims/python % export LD_LIBRARY_PATH=/usr/local/lib
これで無事docker buildが通るようになりました。
終わり
やったね。
追記
解決したかと思いきや、今の所ランダムで起きてます…どうしたらいいんだこれ…
何か解決策が出てきたらまた記事にしたいと思います。
てなわけで買って下さい。超おすすめの本たちです。 ↓