LoginSignup
2
2

More than 3 years have passed since last update.

【Rails】Dockerによる環境構築でビルドする際に出たエラーメモ

Posted at

始めに

Docker Composeを使用してRailsの開発環境を構築する際、ビルドコマンドを実行した時点でエラーが出たので、そのメモです。

環境

Docker for Mac
Docker Eingine : 19.03.8
docker-compose : v3

エラー箇所

1:Rails開発環境用の作業ディレクトリを作成。
2:ディレクトリ内にRails実行環境用のイメージ作成用のDockerfileの作成と内容の記述。
3:Gemfileの作成と内容の記述。
4:中身が空のGemfile.lockファイルを作成。
5:docker-compose.ymlファイルを作成と内容の記述。
6:ymlファイルで定義した内容のビルドコマンド実行 ⬅︎ココ

内容

実行コマンド

$ docker-compose run web rails new . --force --database=postgresql


エラー内容

docker.errors.TLSParameterError: 
Path to a certificate and key files must be provided through the client_config param. 
TLS configurations should map the Docker CLI client configurations. 
See https://docs.docker.com/engine/articles/https/ for API details.
[20623] Failed to execute script docker-compose


解決方法

$ eval $(docker-machine env -u)

  ➡︎上記のコマンドを実行し、再度ビルドコマンドを実行すると成功しました。

まとめ

どうやら、Dockerを起動するには環境変数を一旦デフォルトの状態に戻してから起動する必要があるらしいです。
正直、何故なのかはいまいちわかっていないので課題です。

参考

http://docs.docker.jp/machine/reference/env.html
https://docs.docker.com/engine/security/https/
https://github.com/docker/for-win/issues/2706
https://gitmemory.com/issue/docker/for-win/2706/490941530

2
2
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
2
2