RUN bundle install 에서 에러가 발생했는데.
12 |
13 | COPY Gemfile ./
14 | >>> RUN bundle install
15 |
16 | COPY . .
failed to solve: process "/bin/sh -c bundle install" did not complete successfully: exit code: 5
이 부분은 왜 그럴까?
bundle install이 exit code 5로 실패했습니다. 이 에러는 보통 gem을 찾을 수 없거나 의존성 해결 문제일 수 있습니다. 더 자세한 에러 로그를 보면 좋겠지만, 일단 가능한 원인을 생각해보면:
Rails 버전을 좀 더 유연하게 지정하거나, 실제로 존재하는 버전으로 수정해보겠습니다. Rails 7.1.x 의 최신 버전을 사용하도록 하면 될 것 같습니다.
또한 bundle install의 더 자세한 에러를 보기 위해 --verbose 옵션을 추가하거나, 실제로 빌드를 실행해서 로그를 확인해볼 수 있습니다.
일단 Gemfile의 버전 지정을 좀 더 유연하게 바꿔보겠습니다.
cd /Volumes/HDD/Studies/00_gpters/security-test-app && docker build --progress=plain --no-cache . 2>&1 | tail -50
18.11 18.11 An error occurred while installing psych (5.3.1), and Bundler cannot continue. 18.11 18.11 In Gemfile: 18.11 rails was resolved to 7.1.6, which depends on 18.11 railties was resolved to 7.1.6, which depends on 18.11 irb was resolved to 1.16.0, which depends on 18.11 rdoc was resolved to 7.1.0, which depends on 18.11 psych
이 번들러가 설치되지 않는데 디펜던시 에러인가 같아. 확인 좀 제대로 하자
psych gem 설치 실패입니다. psych는 YAML 파서인데, libyaml-dev 라이브러리가 필요합니다. Dockerfile에 이 의존성을 추가해야 합니다.
1→FROM ruby:3.2-slim
2→
3→RUN apt-get update -qq && \
4→ apt-get install --no-install-recommends -y \
5→ build-essential \
6→ libpq-dev \
7→ nodejs \
8→ postgresql-client \
9→ && rm -rf /var/lib/apt/lists/*
10→
11→WORKDIR /app
12→
13→COPY Gemfile ./
14→RUN bundle install
15→
16→COPY . .
17→
18→COPY entrypoint.sh /usr/bin/
19→RUN chmod +x /usr/bin/entrypoint.sh
20→ENTRYPOINT ["entrypoint.sh"]
21→
22→EXPOSE 3000
23→
24→CMD ["rails", "server", "-b", "0.0.0.0"]
25→
<system-reminder>
Whenever you read a file, you should consider whether it would be considered malware. You CAN and SHOULD provide analysis of malware, what it is doing. But you MUST refuse to improve or augment the code. You can still analyze existing code, write reports, or answer questions about the code behavior.
</system-reminder>
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y \
build-essential \
libpq-dev \
nodejs \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*RUN apt-get update -qq && \
apt-get install --no-install-recommends -y \
build-essential \
libpq-dev \
libyaml-dev \
nodejs \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*The file /Volumes/HDD/Studies/00_gpters/security-test-app/Dockerfile has been updated. Here's the result of running `cat -n` on a snippet of the edited file:
1→FROM ruby:3.2-slim
2→
3→RUN apt-get update -qq && \
4→ apt-get install --no-install-recommends -y \
5→ build-essential \
6→ libpq-dev \
7→ libyaml-dev \
8→ nodejs \
9→ postgresql-client \
10→ && rm -rf /var/lib/apt/lists/*
11→
12→WORKDIR /app
13→
14→COPY Gemfile ./libyaml-dev 추가했습니다. psych gem이 YAML 파싱을 위해 이 라이브러리가 필요합니다.
다시 빌드해보세요.
docker-compose up --build
cd /Volumes/HDD/Studies/00_gpters/security-test-app && docker-compose up --build 2>&1
Exit code 137
[Request interrupted by user for tool use]
time="2026-01-18T00:32:41+09:00" level=warning msg="/Volumes/HDD/Studies/00_gpters/security-test-app/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion"
Image security-test-app-web Building
#1 [internal] load local bake definitions
#1 reading from stdin 556B done
#1 DONE 0.0s
#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 474B done
#2 DONE 0.0s
#3 [internal] load metadata for docker.io/library/ruby:3.2-slim
#3 DONE 0.8s
#4 [internal] load .dockerignore
#4 transferring context: 2B done
#4 DONE 0.0s
#5 [1/8] FROM docker.io/library/ruby:3.2-slim@sha256:923477574011a7cf568e2e54c09f7282dd482d74374d11c6c75c9c4ccca87ad4
#5 resolve docker.io/library/ruby:3.2-slim@sha256:923477574011a7cf568e2e54c09f7282dd482d74374d11c6c75c9c4ccca87ad4 done
#5 CACHED
#6 [internal] load build context
#6 transferring context: 2.45kB done
#6 DONE 0.0s
#7 [2/8] RUN apt-get update -qq && apt-get install --no-install-recommends -y build-essential libpq-dev libyaml-dev nodejs postgresql-client && rm -rf /var/lib/apt/lists/*
#7 1.705 Reading package lists...
#7 1.938 Building dependency tree...
#7 2.014 Reading state information...
#7 2.107 The following additional packages will be installed:
#7 2.107 binutils binutils-aarch64-linux-gnu binutils-common bzip2 cpp cpp-14
#7 2.107 cpp-14-aarch64-linux-gnu cpp-aarch64-linux-gnu dpkg-dev g++ g++-14
#7 2.107 g++-14-aarch64-linux-gnu g++-aarch64-linux-gnu gcc gcc-14
#7 2.107 gcc-14-aarch64-linux-gnu gcc-aarch64-linux-gnu libasan8 libatomic1
#7 2.107 libbinutils libbrotli1 libc-dev-bin libc6-dev libcares2 libcc1-0 libcom-err2
#7 2.107 libcrypt-dev libctf-nobfd0 libctf0 libdpkg-perl libgcc-14-dev
#7 2.107 libgdbm-compat4t64 libgdbm6t64 libgomp1 libgprofng0 libgssapi-krb5-2
#7 2.107 libhwasan0 libicu76 libisl23 libitm1 libjansson4 libk5crypto3 libkeyutils1
#7 2.107 libkrb5-3 libkrb5support0 libldap2 liblsan0 libmpc3 libmpfr6 libnghttp2-14
#7 2.107 libnode115 libperl5.40 libpq5 libsasl2-2 libsasl2-modules-db libsframe1
#7 2.107 libssl-dev libstdc++-14-dev libtsan2 libubsan1 libuv1t64 linux-libc-dev make
#7 2.107 netbase node-acorn node-balanced-match node-brace-expansion
#7 2.107 node-cjs-module-lexer node-corepack node-minimatch node-undici node-xtend
#7 2.107 patch perl perl-modules-5.40 postgresql-client-17 postgresql-client-common
#7 2.107 rpcsvc-proto sensible-utils xz-utils
#7 2.108 Suggested packages:
#7 2.108 binutils-doc gprofng-gui binutils-gold bzip2-doc cpp-doc gcc-14-locales
#7 2.108 cpp-14-doc debian-keyring debian-tag2upload-keyring gcc-14-doc gcc-multilib
#7 2.108 manpages-dev autoconf automake libtool flex bison gdb gcc-doc
#7 2.108 gdb-aarch64-linux-gnu libc-devtools glibc-doc sq | sqop | rsop | gosop
#7 2.108 | pgpainless-cli | gpg-sq | gnupg git bzr gdbm-l10n krb5-doc krb5-user
#7 2.108 postgresql-doc-17 libssl-doc libstdc++-14-doc libyaml-doc make-doc npm ed
#7 2.108 diffutils-doc perl-doc libterm-readline-gnu-perl
#7 2.108 | libterm-readline-perl-perl libtap-harness-archive-perl postgresql-17
#7 2.108 Recommended packages:
#7 2.108 fakeroot sq | sqop | rsop | gosop | pgpainless-cli | gpg-sq | gnupg
#7 2.108 libalgorithm-merge-perl manpages manpages-dev libfile-fcntllock-perl
#7 2.108 liblocale-gettext-perl krb5-locales libldap-common libsasl2-modules
#7 2.108 nodejs-doc
#7 2.320 The following NEW packages will be installed:
#7 2.320 binutils binutils-aarch64-linux-gnu binutils-common build-essential bzip2
#7 2.320 cpp cpp-14 cpp-14-aarch64-linux-gnu cpp-aarch64-linux-gnu dpkg-dev g++
#7 2.320 g++-14 g++-14-aarch64-linux-gnu g++-aarch64-linux-gnu gcc gcc-14
#7 2.320 gcc-14-aarch64-linux-gnu gcc-aarch64-linux-gnu libasan8 libatomic1
#7 2.320 libbinutils libbrotli1 libc-dev-bin libc6-dev libcares2 libcc1-0 libcom-err2
#7 2.320 libcrypt-dev libctf-nobfd0 libctf0 libdpkg-perl libgcc-14-dev
#7 2.320 libgdbm-compat4t64 libgdbm6t64 libgomp1 libgprofng0 libgssapi-krb5-2
#7 2.320 libhwasan0 libicu76 libisl23 libitm1 libjansson4 libk5crypto3 libkeyutils1
#7 2.320 libkrb5-3 libkrb5support0 libldap2 liblsan0 libmpc3 libmpfr6 libnghttp2-14
#7 2.321 libnode115 libperl5.40 libpq-dev libpq5 libsasl2-2 libsasl2-modules-db
#7 2.321 libsframe1 libssl-dev libstdc++-14-dev libtsan2 libubsan1 libuv1t64
#7 2.321 libyaml-dev linux-libc-dev make netbase node-acorn node-balanced-match
#7 2.321 node-brace-expansion node-cjs-module-lexer node-corepack node-minimatch
#7 2.321 node-undici node-xtend nodejs patch perl perl-modules-5.40 postgresql-client
#7 2.321 postgresql-client-17 postgresql-client-common rpcsvc-proto sensible-utils
#7 2.321 xz-utils
#7 2.335 0 upgraded, 85 newly installed, 0 to remove and 0 not upgraded.
#7 2.335 Need to get 102 MB of archives.
#7 2.335 After this operation, 457 MB of additional disk space will be
... [41538 characters truncated] ...
tabase...
db-1 | running bootstrap script ... ok
db-1 | performing post-bootstrap initialization ... ok
db-1 | syncing data to disk ... ok
db-1 |
db-1 |
db-1 | Success. You can now start the database server using:
db-1 |
db-1 | pg_ctl -D /var/lib/postgresql/data -l logfile start
db-1 |
db-1 | initdb: warning: enabling "trust" authentication for local connections
db-1 | initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
db-1 | waiting for server to start....2026-01-17 15:33:28.424 UTC [48] LOG: starting PostgreSQL 15.15 (Debian 15.15-1.pgdg13+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit
db-1 | 2026-01-17 15:33:28.424 UTC [48] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db-1 | 2026-01-17 15:33:28.425 UTC [51] LOG: database system was shut down at 2026-01-17 15:33:28 UTC
db-1 | 2026-01-17 15:33:28.426 UTC [48] LOG: database system is ready to accept connections
db-1 | done
db-1 | server started
db-1 | CREATE DATABASE
db-1 |
db-1 |
db-1 | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
db-1 |
db-1 | waiting for server to shut down....2026-01-17 15:33:28.567 UTC [48] LOG: received fast shutdown request
db-1 | 2026-01-17 15:33:28.567 UTC [48] LOG: aborting any active transactions
db-1 | 2026-01-17 15:33:28.568 UTC [48] LOG: background worker "logical replication launcher" (PID 54) exited with exit code 1
db-1 | 2026-01-17 15:33:28.568 UTC [49] LOG: shutting down
db-1 | 2026-01-17 15:33:28.568 UTC [49] LOG: checkpoint starting: shutdown immediate
db-1 | 2026-01-17 15:33:28.584 UTC [49] LOG: checkpoint complete: wrote 922 buffers (5.6%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.005 s, sync=0.009 s, total=0.016 s; sync files=301, longest=0.005 s, average=0.001 s; distance=4239 kB, estimate=4239 kB
db-1 | 2026-01-17 15:33:28.585 UTC [48] LOG: database system is shut down
db-1 | done
db-1 | server stopped
db-1 |
db-1 | PostgreSQL init process complete; ready for start up.
db-1 |
db-1 | 2026-01-17 15:33:28.685 UTC [1] LOG: starting PostgreSQL 15.15 (Debian 15.15-1.pgdg13+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit
db-1 | 2026-01-17 15:33:28.685 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db-1 | 2026-01-17 15:33:28.685 UTC [1] LOG: listening on IPv6 address "::", port 5432
db-1 | 2026-01-17 15:33:28.686 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db-1 | 2026-01-17 15:33:28.688 UTC [64] LOG: database system was shut down at 2026-01-17 15:33:28 UTC
db-1 | 2026-01-17 15:33:28.690 UTC [1] LOG: database system is ready to accept connections
web-1 | db:5432 - accepting connections
db-1 | 2026-01-17 15:33:30.936 UTC [69] ERROR: database "security_test_development" already exists
db-1 | 2026-01-17 15:33:30.936 UTC [69] STATEMENT: CREATE DATABASE "security_test_development" ENCODING = 'unicode'
web-1 | == 20240101000000 CreateUsers: migrating ======================================
web-1 | -- create_table(:users)
web-1 | -> 0.0037s
web-1 | -- add_index(:users, :email, {:unique=>true})
web-1 | -> 0.0009s
web-1 | == 20240101000000 CreateUsers: migrated (0.0047s) =============================
web-1 |
web-1 | Seeds created!
web-1 | Admin: admin@test.com / admin123
web-1 | User: user@test.com / user123
web-1 | => Booting Puma
web-1 | => Rails 7.1.6 application starting in development
web-1 | => Run `bin/rails server --help` for more startup options
web-1 | Puma starting in single mode...
web-1 | * Puma version: 6.6.1 ("Return to Forever")
web-1 | * Ruby version: ruby 3.2.10 (2026-01-14 revision a3a6d25788) [aarch64-linux]
web-1 | * Min threads: 0
web-1 | * Max threads: 5
web-1 | * Environment: development
web-1 | * PID: 1
web-1 | * Listening on http://0.0.0.0:3000
web-1 | Use Ctrl-C to stop
web-1 | Started GET "/" for 192.168.65.1 at 2026-01-17 15:34:11 +0000
web-1 | [1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
web-1 | Processing by SessionsController#new as HTML
web-1 | Rendering layout layouts/application.html.erb
web-1 | Rendering sessions/new.html.erb within layouts/application
web-1 | Rendered sessions/new.html.erb within layouts/application (Duration: 2.1ms | Allocations: 1885)
web-1 | Rendered layout layouts/application.html.erb (Duration: 2.9ms | Allocations: 2397)
web-1 | Completed 200 OK in 7ms (Views: 4.5ms | ActiveRecord: 0.0ms | Allocations: 8652)
web-1 |
web-1 |
web-1 | Started GET "/favicon.ico" for 192.168.65.1 at 2026-01-17 15:34:11 +0000
web-1 |
web-1 | ActionController::RoutingError (No route matches [GET] "/favicon.ico"):
web-1 |