質問編集履歴

1

タイトルとエラー内容の更新

2020/08/14 05:08

投稿

退会済みユーザー
test CHANGED
@@ -1 +1 @@
1
- [Docker]rails でDockerfileの設定
1
+ タイトル[Docker]権限エラー Operation not permitted @ rb_sysopen
test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ```Dockerfile
6
6
 
7
- FROM ruby:2.5.1
7
+ FROM ruby:2.5.8
8
8
 
9
9
  RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
10
10
 
@@ -16,15 +16,15 @@
16
16
 
17
17
 
18
18
 
19
- COPY Gemfile /aaaa/Gemfile
19
+ ADD Gemfile /aaaa/Gemfile
20
-
21
- COPY Gemfile.lock /aaaa/Gemfile.lock
22
20
 
23
21
 
24
22
 
25
- RUN gem install bundler && bundle install
26
23
 
24
+
27
- COPY . /aaaa
25
+ RUN gem update bundler && bundle install --path vendor/bundle
26
+
27
+ CMD ["rails", "server", "-b", "0.0.0.0"]
28
28
 
29
29
  ```
30
30
 
@@ -38,7 +38,7 @@
38
38
 
39
39
  db:
40
40
 
41
- image: mysql:5.7
41
+ image: mysql:5.6
42
42
 
43
43
  environment:
44
44
 
@@ -50,23 +50,21 @@
50
50
 
51
51
  - "4306:3306"
52
52
 
53
- volumes:
54
-
55
- - ./db/mysql/volumes:/var/lib/mysql
56
-
57
- tty: true
58
-
59
53
 
60
54
 
61
55
  web:
62
56
 
63
57
  build: .
64
58
 
65
- command: bundle exec rails s -p 3000 -b '0.0.0.0'
59
+ command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
66
60
 
67
61
  volumes:
68
62
 
69
63
  - .:/aaaa
64
+
65
+ environment:
66
+
67
+ BUNDLE_APP_CONFIG: /aaaa/vendor/bundle
70
68
 
71
69
  ports:
72
70
 
@@ -76,91 +74,47 @@
76
74
 
77
75
  - db
78
76
 
77
+ privileged: true
78
+
79
+ tty: true
80
+
81
+ stdin_open: true
82
+
83
+ volumes:
84
+
85
+ bundle_install:
86
+
87
+ driver: local
88
+
79
89
  ```
80
90
 
81
91
  エラー内容は以下のものになります。
82
92
 
83
93
  ```ここに言語を入力
84
94
 
85
- bundler: failed to load command: rails (/usr/local/bundle/bin/rails)
95
+ web_1 | Traceback (most recent call last):
86
96
 
87
- /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/dsl.rb:528:in `read': Operation not permitted @ rb_sysopen - /KStargram/Gemfile (Errno::EPERM)
97
+ web_1 | 9: from /usr/local/bundle/bin/bundle:23:in `<main>'
88
98
 
89
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/dsl.rb:528:in `contents'
99
+ web_1 | 8: from /usr/local/lib/ruby/site_ruby/2.5.0/rubygems.rb:302:in `activate_bin_path'
90
100
 
91
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/dsl.rb:558:in `to_s'
101
+ web_1 | 7: from /usr/local/lib/ruby/site_ruby/2.5.0/rubygems.rb:272:in `find_spec_for_exe'
92
102
 
93
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/cli/exec.rb:81:in `message'
103
+ web_1 | 6: from /usr/local/lib/ruby/site_ruby/2.5.0/rubygems/dependency.rb:284:in `matching_specs'
94
104
 
95
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/cli/exec.rb:81:in `rescue in kernel_load'
105
+ web_1 | 5: from /usr/local/lib/ruby/site_ruby/2.5.0/rubygems/bundler_version_finder.rb:45:in `filter!'
96
106
 
97
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/cli/exec.rb:65:in `kernel_load'
107
+ web_1 | 4: from /usr/local/lib/ruby/site_ruby/2.5.0/rubygems/bundler_version_finder.rb:7:in `bundler_version'
98
108
 
99
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/cli/exec.rb:28:in `run'
109
+ web_1 | 3: from /usr/local/lib/ruby/site_ruby/2.5.0/rubygems/bundler_version_finder.rb:22:in `bundler_version_with_reason'
100
110
 
101
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/cli.rb:424:in `exec'
111
+ web_1 | 2: from /usr/local/lib/ruby/site_ruby/2.5.0/rubygems/bundler_version_finder.rb:68:in `lockfile_version'
102
112
 
103
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
113
+ web_1 | 1: from /usr/local/lib/ruby/site_ruby/2.5.0/rubygems/bundler_version_finder.rb:96:in `lockfile_contents'
104
114
 
105
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
115
+ web_1 | /usr/local/lib/ruby/site_ruby/2.5.0/rubygems/bundler_version_finder.rb:96:in `read': Operation not permitted @ rb_sysopen - /aaaa/Gemfile.lock (Errno::EPERM)
106
116
 
107
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
108
-
109
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/cli.rb:27:in `dispatch'
110
-
111
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
112
-
113
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/cli.rb:18:in `start'
114
-
115
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/exe/bundle:30:in `block in <top (required)>'
116
-
117
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
118
-
119
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/exe/bundle:22:in `<top (required)>'
120
-
121
- from /usr/local/bundle/bin/bundle:23:in `load'
117
+ web_1 | aaaa_web_1 exited with code 1
122
-
123
- from /usr/local/bundle/bin/bundle:23:in `<main>'
124
-
125
- bundler: failed to load command: rails (/usr/local/bundle/bin/rails)
126
-
127
- /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/dsl.rb:528:in `read': Operation not permitted @ rb_sysopen - /KStargram/Gemfile (Errno::EPERM)
128
-
129
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/dsl.rb:528:in `contents'
130
-
131
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/dsl.rb:558:in `to_s'
132
-
133
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/cli/exec.rb:81:in `message'
134
-
135
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/cli/exec.rb:81:in `rescue in kernel_load'
136
-
137
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/cli/exec.rb:65:in `kernel_load'
138
-
139
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/cli/exec.rb:28:in `run'
140
-
141
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/cli.rb:424:in `exec'
142
-
143
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
144
-
145
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
146
-
147
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
148
-
149
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/cli.rb:27:in `dispatch'
150
-
151
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
152
-
153
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/cli.rb:18:in `start'
154
-
155
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/exe/bundle:30:in `block in <top (required)>'
156
-
157
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
158
-
159
- from /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.6/exe/bundle:22:in `<top (required)>'
160
-
161
- from /usr/local/bundle/bin/bundle:23:in `load'
162
-
163
- from /usr/local/bundle/bin/bundle:23:in `<main>'
164
118
 
165
119
  ```
166
120