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でrailsコマンドが打てない

Posted at

1.困っていたこと

Dockerコンテナに入った後に、railsコマンドが使用できず困っていました。

ターミナルでDockerコンテナに入る

$ docker-compose exec コンテナ名 bash

railsコマンドを打つ

root@------/------# rails routes 

すると

root@------/------# rails routes 
bash: rails: command not found

そのようなコマンドはないとの表示。

2.解決

Dockerコンテナ内からrailsコマンドを打つときは、bundle execをつけること。

root@------/------# bundle exec rails routes 

これで無事にrails コマンドが通りました。

3.コンテナ外からコマンドを打つ場合

docker-compose exec コンテナ名 bundle exec rails
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?