質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
MacOS(OSX)

MacOSとは、Appleの開発していたGUI(グラフィカルユーザーインターフェース)を採用したオペレーションシステム(OS)です。Macintoshと共に、市場に出てGUIの普及に大きく貢献しました。

コマンドライン

コマンドライン(別名:Command Line Interface)は、ユーザに命令の入力を促す(プロンプト)文字列の表示を行い、すべての操作をキーボードを用いて文字列を打ち込む事でプログラムを走らせるユーザインターフェースです。

Q&A

解決済

1回答

1091閲覧

Macのターミナルでpwdで表示されるパスとコマンドを実行するときのパスが異なる

makoxti

総合スコア32

MacOS(OSX)

MacOSとは、Appleの開発していたGUI(グラフィカルユーザーインターフェース)を採用したオペレーションシステム(OS)です。Macintoshと共に、市場に出てGUIの普及に大きく貢献しました。

コマンドライン

コマンドライン(別名:Command Line Interface)は、ユーザに命令の入力を促す(プロンプト)文字列の表示を行い、すべての操作をキーボードを用いて文字列を打ち込む事でプログラムを走らせるユーザインターフェースです。

0グッド

0クリップ

投稿2021/07/24 01:31

編集2021/07/25 12:23

Macのターミナルでpwdと打つとちゃんと現在のパスが表示されるが、「docker-compose build」というコマンドを打つとパスの最後に「◯◯/◯◯/.env」と表示され、no such file or directoryとなってしまう

・実行結果
fukushigeshinjitsunoMacBook-Air bulletinbord % ls
Dockerfile Gemfile.lock entrypoint.sh
Gemfile docker-compose.yml readme.txt
fukushigeshinjitsunoMacBook-Air bulletinbord % docker-compose build
open /Users/ユーザー名/workspace/ruby/bulletinbord/.env: no such file or directory
fukushigeshinjitsunoMacBook-Air bulletinbord % ls -l
total 56
-rw-r--r-- 1 ユーザー名 staff 595 7 24 03:25 Dockerfile
-rw-r--r-- 1 ユーザー名 staff 1991 7 24 03:42 Gemfile
-rw-r--r-- 1 ユーザー名 staff 5789 7 24 03:43 Gemfile.lock
-rw-r--r-- 1 ユーザー名 staff 608 7 24 03:52 docker-compose.yml
-rw-r--r-- 1 ユーザー名 staff 201 7 24 02:24 entrypoint.sh
-rw-r--r-- 1 ユーザー名 staff 119 7 24 04:03 readme.txt
fukushigeshinjitsunoMacBook-Air bulletinbord % docker-compose conf
ig
open /Users/ユーザー名/workspace/ruby/bulletinbord/.env: no such file or directory
fukushigeshinjitsunoMacBook-Air bulletinbord % pwd
/Users/ユーザー名/workspace/ruby/bulletinbord
fukushigeshinjitsunoMacBook-Air bulletinbord %

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

Noin

2021/07/24 01:56

・ディレクトリの中身 ・実行コマンド ・その結果 ・こちらのコマンド結果(docker-compose config) 上記の記載をお願いします。
makoxti

2021/07/24 02:13

Noin様 コマンド実行結果を追記しました。 ご確認お願いします。
Noin

2021/07/24 03:02

さすがにユーザー名は伏せて頂けると。。。色々怖いと思いますので open /Users/fukujuumakoto/workspace/ruby/bulletinbord/.env: no such file or directory このエラーだとdocker側ではなく、ruby側のように見えますね。
makoxti

2021/07/24 04:07

K_3578様 見ているユーザーが違うと思い、Qiitaでも投稿しました。
makoxti

2021/07/24 04:07

@Noin様 そうなのですね。 なぜ.envがついてしまうのか、ググッてるんですがわからず…
Noin

2021/07/24 04:15

可能であればファイルの中身を読まさせて頂きたいです。 dockerfile、docker-compose.yml、gemfile,gemfile.lock
K_3578

2021/07/24 04:30

@makoxtiさん teratailヘルプページに書いてある通り、マルチポストは基本的に非推奨です。 どうしてもマルチポストをする場合は下記の通り対応してください。 https://teratail.com/help#posted-otherservice
makoxti

2021/07/24 04:47

Noin様 承知しました。 今出先なので、帰宅したら投稿させて頂きます。
makoxti

2021/07/25 12:21 編集

お待たせしました。 ・Docker FROM ruby:3.0.0 RUN apt-get update -qq && apt-get install -y build-essential nodejs RUN mkdir /app WORKDIR /app COPY Gemfile /app/Gemfile COPY Gemfile.lock /app/Gemfile.lock RUN bundle install COPY . /app RUN curl https://deb.nodesource.com/setup_12.x | bash RUN wget --quiet -O - /tmp/pubkey.gpg https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ echo 'deb http://dl.yarnpkg.com/debian/ stable main' > /etc/apt/sources.list.d/yarn.list RUN set -x && apt-get update -y -qq && apt-get install -yq nodejs yarn RUN apt-get update && apt-get install -y nodejs yarn postgresql-client ・docker-compose.yml version: '3' services: node: build: context: . dockerfile: Dockerfile volumes: - ./:/usr/src/app command: sh -c "npm run dev" ports: - '3000:3000' db: image: mysql:latest restart: always hostname: my-mysql env_file: - .env environment: MYSQL_USER: sample_user MYSQL_PASSWORD: password MYSQL_DATABASE: sample_db MYSQL_ROOT_PASSWORD: password ports: - 3306:3306 expose: - '3306' volumes: - ./db/mysql_init:/docker-entrypoint-initdb.d - ./db/mysql_data:/var/lib/mysql tty: true ・gemfile source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '3.0.0' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 6.0.3', '>= 6.0.3.4' # Use mysql as the database for Active Record gem 'mysql2', '>= 0.4.4' # Use Puma as the app server gem 'puma', '~> 4.1' # Use SCSS for stylesheets gem 'sass-rails', '>= 6' # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker gem 'webpacker', '~> 4.0' # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks gem 'turbolinks', '~> 5' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.7' # Use Redis adapter to run Action Cable in production # gem 'redis', '~> 4.0' # Use Active Model has_secure_password # gem 'bcrypt', '~> 3.1.7' # Use Active Storage variant # gem 'image_processing', '~> 1.2' # Reduces boot times through caching; required in config/boot.rb gem 'bootsnap', '>= 1.4.2', require: false group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] end group :development do # Access an interactive console on exception pages or by calling 'console' anywhere in the code. gem 'web-console', '>= 3.3.0' gem 'listen', '~> 3.2' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' end group :test do # Adds support for Capybara system testing and selenium driver gem 'capybara', '>= 2.15' gem 'selenium-webdriver' # Easy installation and use of web drivers to run system tests with browsers gem 'webdrivers' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] gem 'bootstrap', '~> 4.0.0' ・gemfile.lock GEM remote: https://rubygems.org/ specs: actioncable (6.0.4) actionpack (= 6.0.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) actionmailbox (6.0.4) actionpack (= 6.0.4) activejob (= 6.0.4) activerecord (= 6.0.4) activestorage (= 6.0.4) activesupport (= 6.0.4) mail (>= 2.7.1) actionmailer (6.0.4) actionpack (= 6.0.4) actionview (= 6.0.4) activejob (= 6.0.4) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) actionpack (6.0.4) actionview (= 6.0.4) activesupport (= 6.0.4) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) actiontext (6.0.4) actionpack (= 6.0.4) activerecord (= 6.0.4) activestorage (= 6.0.4) activesupport (= 6.0.4) nokogiri (>= 1.8.5) actionview (6.0.4) activesupport (= 6.0.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) activejob (6.0.4) activesupport (= 6.0.4) globalid (>= 0.3.6) activemodel (6.0.4) activesupport (= 6.0.4) activerecord (6.0.4) activemodel (= 6.0.4) activesupport (= 6.0.4) activestorage (6.0.4) actionpack (= 6.0.4) activejob (= 6.0.4) activerecord (= 6.0.4) marcel (~> 1.0.0) activesupport (6.0.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) zeitwerk (~> 2.2, >= 2.2.2) addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) autoprefixer-rails (10.2.5.1) execjs (> 0) bindex (0.8.1) bootsnap (1.7.5) msgpack (~> 1.0) bootstrap (4.0.0) autoprefixer-rails (>= 6.0.3) popper_js (>= 1.12.9, < 2) sass (>= 3.5.2) builder (3.2.4) byebug (11.1.3) capybara (3.35.3) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) childprocess (3.0.0) concurrent-ruby (1.1.9) crass (1.0.6) erubi (1.10.0) execjs (2.8.1) ffi (1.15.3) globalid (0.4.2) activesupport (>= 4.2.0) i18n (1.8.10) concurrent-ruby (~> 1.0) jbuilder (2.11.2) activesupport (>= 5.0.0) listen (3.6.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) loofah (2.10.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) marcel (1.0.1) method_source (1.0.0) mini_mime (1.1.0) mini_portile2 (2.5.3) minitest (5.14.4) msgpack (1.4.2) mysql2 (0.5.3) nio4r (2.5.7) nokogiri (1.11.7) mini_portile2 (~> 2.5.0) racc (~> 1.4) popper_js (1.16.0) public_suffix (4.0.6) puma (4.3.8) nio4r (~> 2.0) racc (1.5.2) rack (2.2.3) rack-proxy (0.7.0) rack rack-test (1.1.0) rack (>= 1.0, < 3) rails (6.0.4) actioncable (= 6.0.4) actionmailbox (= 6.0.4) actionmailer (= 6.0.4) actionpack (= 6.0.4) actiontext (= 6.0.4) actionview (= 6.0.4) activejob (= 6.0.4) activemodel (= 6.0.4) activerecord (= 6.0.4) activestorage (= 6.0.4) activesupport (= 6.0.4) bundler (>= 1.3.0) railties (= 6.0.4) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) railties (6.0.4) actionpack (= 6.0.4) activesupport (= 6.0.4) method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) rake (13.0.6) rb-fsevent (0.11.0) rb-inotify (0.10.1) ffi (~> 1.0) regexp_parser (2.1.1) rubyzip (2.3.2) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) sassc (2.4.0) ffi (~> 1.9) sassc-rails (2.1.2) railties (>= 4.0.0) sassc (>= 2.0) sprockets (> 3.0) sprockets-rails tilt selenium-webdriver (3.142.7) childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) spring (2.1.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) sprockets (4.0.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.2) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) thor (1.1.0) thread_safe (0.3.6) tilt (2.0.10) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) tzinfo (1.2.9) thread_safe (~> 0.1) web-console (4.1.0) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) webdrivers (4.6.0) nokogiri (~> 1.6) rubyzip (>= 1.3.0) selenium-webdriver (>= 3.0, < 4.0) webpacker (4.3.0) activesupport (>= 4.2) rack-proxy (>= 0.6.1) railties (>= 4.2) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) zeitwerk (2.4.2) PLATFORMS aarch64-linux DEPENDENCIES bootsnap (>= 1.4.2) bootstrap (~> 4.0.0) byebug capybara (>= 2.15) jbuilder (~> 2.7) listen (~> 3.2) mysql2 (>= 0.4.4) puma (~> 4.1) rails (~> 6.0.3, >= 6.0.3.4) sass-rails (>= 6) selenium-webdriver spring spring-watcher-listen (~> 2.0.0) turbolinks (~> 5) tzinfo-data web-console (>= 3.3.0) webdrivers webpacker (~> 4.0) RUBY VERSION ruby 3.0.0p0 BUNDLED WITH 2.2.3
makoxti

2021/07/24 14:32

rubyをアンインストールし、再インストールしましたが、事象は変わりませんでした。
quickquip

2021/07/25 07:14

情報はこの欄にではなくて質問を編集して記載しましょう
makoxti

2021/07/25 12:23

文字数制限に引っかかるためこちらに記載しました
guest

回答1

0

ベストアンサー

"mysql関連の設定に関して.envのファイルから読み込みなさい"と、docker-compose.ymlの中に自分で指定しているにも関わらず、そのファイルを作ってないだけだと思います。


.で始まるファイルの存在を確認したい場合はls -aとしてください。

http://linuxjm.osdn.jp/html/GNU_coreutils/man1/ls.1.html

-a, --all
. で始まる要素を無視しない

投稿2021/07/26 11:38

編集2021/07/26 11:42
quickquip

総合スコア11038

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

makoxti

2021/07/26 12:21

おっしゃる通り、.envファイルを作成したら解消しました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問