2
1

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.

dockerでgemを追加したときにbundle installではなくbuildする

Last updated at Posted at 2021-03-02

備忘録的な感じです

題名にある通りDockerでrails開発をしていてgemを追加した後

$ docker-compose run --rm (コンテナ名) bundle install

を試したらgemが更新されずエラーになる

$ docker-compose build

でエラーも出ず解決した。

色々調べていたらdockerfileの

Dokerfile
FROM ruby:2.6.6
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
RUN mkdir /rails-qanda
WORKDIR /rails-qanda
COPY Gemfile /rails-qanda/Gemfile
COPY Gemfile.lock /rails-qanda/Gemfile.lock
RUN bundle install
COPY . /rails-qanda

のCOPY Gemfile /rails-qanda/Gemfileが
[COPY] ローカルのファイルをコンテナへコピー
という意味らしいのでgemを追加したらここの部分やり直すためにbuildし直すということなのかな。

また理解が深まり次第追記予定

docker難しい、、

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?