主頁 > 後端開發 > 如何在docker環境中安裝yarn?

如何在docker環境中安裝yarn?

2021-10-16 15:40:43 後端開發

現在,我正在嘗試在 docker 上為 Ruby on rails 創建環境。我閱讀了一些人撰寫并嘗試過的檔案和一些博客。但是我遇到了錯誤并且無法完成。

好像我必須在docker環境中安裝yarn,但我不知道我是否以正確的方式安裝。

如果有人知道任何事情,請告訴我。

到目前為止我寫的是這樣的。

檔案

FROM ruby:3.0.2
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client


RUN mkdir /docker-test2
WORKDIR /docker-test2
COPY Gemfile /docker-test2/Gemfile
COPY Gemfile.lock /docker-test2/Gemfile.lock
RUN bundle install
COPY . /docker-test2


# Add a script to be executed every time the container starts.
COPY entrypoint.sh /usr/bin/
RUN chmod  x /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 3000

# Start the main process.
CMD ["rails", "server", "-b", "0.0.0.0"]

docker-compose.yml

version: "3.9"
services:
  db:
    image: postgres
    volumes:
      - ./tmp/db:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: password
  web:
    build: .
    command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
    volumes:
      - .:/docker-test2
    ports:
      - "3000:3000"
    depends_on:
      - db

入口點.sh

#!/bin/bash
set -e

# Remove a potentially pre-existing server.pid for Rails.
rm -f /docker-test2/tmp/pids/server.pid

# Then exec the container's main process (what's set as CMD in the Dockerfile).
exec "[email protected]"

當我嘗試時docker-compose run,錯誤說的是這樣的。

    Attaching to docker-test2_db_1, docker-test2_web_1
db_1   | The files belonging to this database system will be owned by user "postgres".
db_1   | This user must also own the server process.
db_1   | 
db_1   | The database cluster will be initialized with locale "en_US.utf8".
db_1   | The default database encoding has accordingly been set to "UTF8".
db_1   | The default text search configuration will be set to "english".
db_1   | 
db_1   | Data page checksums are disabled.
db_1   | 
db_1   | fixing permissions on existing directory /var/lib/postgresql/data ... ok
db_1   | creating subdirectories ... ok
db_1   | selecting dynamic shared memory implementation ... posix
db_1   | selecting default max_connections ... 100
db_1   | selecting default shared_buffers ... 128MB
db_1   | selecting default time zone ... Etc/UTC
db_1   | creating configuration files ... ok
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   | initdb: warning: enabling "trust" authentication for local connections
db_1   | You can change this by editing pg_hba.conf or using the option -A, or
db_1   | --auth-local and --auth-host, the next time you run initdb.
db_1   | 
db_1   |     pg_ctl -D /var/lib/postgresql/data -l logfile start
db_1   | 
db_1   | waiting for server to start....2021-08-30 09:03:01.284 UTC [47] LOG:  starting PostgreSQL 13.4 (Debian 13.4-1.pgdg100 1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
db_1   | 2021-08-30 09:03:01.285 UTC [47] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1   | 2021-08-30 09:03:01.299 UTC [48] LOG:  database system was shut down at 2021-08-30 09:02:59 UTC
db_1   | 2021-08-30 09:03:01.322 UTC [47] LOG:  database system is ready to accept connections
db_1   |  done
db_1   | server started
db_1   | 
db_1   | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
db_1   | 
db_1   | 2021-08-30 09:03:01.497 UTC [47] LOG:  received fast shutdown request
db_1   | waiting for server to shut down....2021-08-30 09:03:01.498 UTC [47] LOG:  aborting any active transactions
db_1   | 2021-08-30 09:03:01.500 UTC [47] LOG:  background worker "logical replication launcher" (PID 54) exited with exit code 1
db_1   | 2021-08-30 09:03:01.500 UTC [49] LOG:  shutting down
db_1   | 2021-08-30 09:03:01.544 UTC [47] 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   | 2021-08-30 09:03:01.627 UTC [1] LOG:  starting PostgreSQL 13.4 (Debian 13.4-1.pgdg100 1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
db_1   | 2021-08-30 09:03:01.627 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_1   | 2021-08-30 09:03:01.627 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1   | 2021-08-30 09:03:01.631 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1   | 2021-08-30 09:03:01.652 UTC [66] LOG:  database system was shut down at 2021-08-30 09:03:01 UTC
db_1   | 2021-08-30 09:03:01.671 UTC [1] LOG:  database system is ready to accept connections
db_1   | 
db_1   | PostgreSQL Database directory appears to contain a database; Skipping initialization
db_1   | 
db_1   | 2021-08-30 09:04:33.607 UTC [1] LOG:  starting PostgreSQL 13.4 (Debian 13.4-1.pgdg100 1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
db_1   | 2021-08-30 09:04:33.607 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_1   | 2021-08-30 09:04:33.607 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1   | 2021-08-30 09:04:33.611 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1   | 2021-08-30 09:04:33.659 UTC [27] LOG:  database system was interrupted; last known up at 2021-08-30 09:03:01 UTC
db_1   | 2021-08-30 09:04:34.659 UTC [27] LOG:  database system was not properly shut down; automatic recovery in progress
db_1   | 2021-08-30 09:04:34.676 UTC [27] LOG:  redo starts at 0/15C6DD8
db_1   | 2021-08-30 09:04:34.676 UTC [27] LOG:  invalid record length at 0/15C6E10: wanted 24, got 0
db_1   | 2021-08-30 09:04:34.676 UTC [27] LOG:  redo done at 0/15C6DD8
db_1   | 2021-08-30 09:04:34.694 UTC [1] LOG:  database system is ready to accept connections
db_1   | 
db_1   | PostgreSQL Database directory appears to contain a database; Skipping initialization
db_1   | 
db_1   | 2021-08-30 09:11:48.053 UTC [1] LOG:  starting PostgreSQL 13.4 (Debian 13.4-1.pgdg100 1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
db_1   | 2021-08-30 09:11:48.053 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_1   | 2021-08-30 09:11:48.053 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1   | 2021-08-30 09:11:48.056 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1   | 2021-08-30 09:11:48.105 UTC [27] LOG:  database system was interrupted; last known up at 2021-08-30 09:04:34 UTC
db_1   | 2021-08-30 09:11:49.433 UTC [27] LOG:  database system was not properly shut down; automatic recovery in progress
db_1   | 2021-08-30 09:11:49.436 UTC [27] LOG:  redo starts at 0/15C6E88
db_1   | 2021-08-30 09:11:49.436 UTC [27] LOG:  invalid record length at 0/15C6EC0: wanted 24, got 0
db_1   | 2021-08-30 09:11:49.436 UTC [27] LOG:  redo done at 0/15C6E88
db_1   | 2021-08-30 09:11:49.454 UTC [1] LOG:  database system is ready to accept connections
web_1  | => Booting Puma
web_1  | => Rails 6.1.4.1 application starting in development 
web_1  | => Run `bin/rails server --help` for more startup options
web_1  | Exiting
web_1  | /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/configuration.rb:103:in `rescue in load': Webpacker configuration file not found /docker-test2/config/webpacker.yml. Please run rails webpacker:install Error: No such file or directory @ rb_sysopen - /docker-test2/config/webpacker.yml (RuntimeError)
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/configuration.rb:95:in `load'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/configuration.rb:92:in `data'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/configuration.rb:88:in `fetch'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/configuration.rb:43:in `public_path'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/configuration.rb:47:in `public_output_path'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/configuration.rb:51:in `public_manifest_path'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/manifest.rb:83:in `load'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/manifest.rb:18:in `refresh'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/commands.rb:47:in `bootstrap'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker.rb:35:in `bootstrap'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/railtie.rb:41:in `block in <class:Engine>'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `instance_exec'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `run'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/initializable.rb:61:in `block in run_initializers'
web_1  |        from /usr/local/lib/ruby/3.0.0/tsort.rb:228:in `block in tsort_each'
web_1  |        from /usr/local/lib/ruby/3.0.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
web_1  |        from /usr/local/lib/ruby/3.0.0/tsort.rb:431:in `each_strongly_connected_component_from'
web_1  |        from /usr/local/lib/ruby/3.0.0/tsort.rb:349:in `block in each_strongly_connected_component'
web_1  |        from /usr/local/lib/ruby/3.0.0/tsort.rb:347:in `each'
web_1  |        from /usr/local/lib/ruby/3.0.0/tsort.rb:347:in `call'
web_1  |        from /usr/local/lib/ruby/3.0.0/tsort.rb:347:in `each_strongly_connected_component'
web_1  |        from /usr/local/lib/ruby/3.0.0/tsort.rb:226:in `tsort_each'
web_1  |        from /usr/local/lib/ruby/3.0.0/tsort.rb:205:in `tsort_each'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/initializable.rb:60:in `run_initializers'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/application.rb:391:in `initialize!'
web_1  |        from /docker-test2/config/environment.rb:5:in `<main>'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
web_1  |        from /usr/local/bundle/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
web_1  |        from /usr/local/bundle/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require'
web_1  |        from /usr/local/bundle/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
web_1  |        from /usr/local/bundle/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `require_relative'
web_1  |        from config.ru:3:in `block in <main>'
web_1  |        from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
web_1  |        from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
web_1  |        from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
web_1  |        from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
web_1  |        from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config'
web_1  |        from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
web_1  |        from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/commands/server/server_command.rb:77:in `log_to_stdout'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/commands/server/server_command.rb:37:in `start'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/commands/server/server_command.rb:144:in `block in perform'
web_1  |        from <internal:kernel>:90:in `tap'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/commands/server/server_command.rb:135:in `perform'
web_1  |        from /usr/local/bundle/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
web_1  |        from /usr/local/bundle/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
web_1  |        from /usr/local/bundle/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/command/base.rb:69:in `perform'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/command.rb:48:in `invoke'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/commands.rb:18:in `<main>'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
web_1  |        from /docker-test2/bin/rails:5:in `<top (required)>'
web_1  |        from /usr/local/bundle/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
web_1  |        from /usr/local/bundle/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
web_1  |        from /usr/local/bundle/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
web_1  |        from /usr/local/bundle/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
web_1  |        from /usr/local/bundle/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
web_1  |        from /usr/local/bundle/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
web_1  |        from /usr/local/bundle/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
web_1  |        from /docker-test2/bin/spring:10:in `require'
web_1  |        from /docker-test2/bin/spring:10:in `block in <top (required)>'
web_1  |        from <internal:kernel>:90:in `tap'
web_1  |        from /docker-test2/bin/spring:7:in `<top (required)>'
web_1  |        from bin/rails:2:in `load'
web_1  |        from bin/rails:2:in `<main>'
web_1  | /usr/local/lib/ruby/3.0.0/psych.rb:581:in `initialize': No such file or directory @ rb_sysopen - /docker-test2/config/webpacker.yml (Errno::ENOENT)
web_1  |        from /usr/local/lib/ruby/3.0.0/psych.rb:581:in `open'
web_1  |        from /usr/local/lib/ruby/3.0.0/psych.rb:581:in `load_file'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/compile_cache/yaml.rb:124:in `load_file'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/configuration.rb:97:in `load'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/configuration.rb:92:in `data'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/configuration.rb:88:in `fetch'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/configuration.rb:43:in `public_path'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/configuration.rb:47:in `public_output_path'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/configuration.rb:51:in `public_manifest_path'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/manifest.rb:83:in `load'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/manifest.rb:18:in `refresh'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/commands.rb:47:in `bootstrap'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker.rb:35:in `bootstrap'
web_1  |        from /usr/local/bundle/gems/webpacker-5.4.2/lib/webpacker/railtie.rb:41:in `block in <class:Engine>'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `instance_exec'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `run'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/initializable.rb:61:in `block in run_initializers'
web_1  |        from /usr/local/lib/ruby/3.0.0/tsort.rb:228:in `block in tsort_each'
web_1  |        from /usr/local/lib/ruby/3.0.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
web_1  |        from /usr/local/lib/ruby/3.0.0/tsort.rb:431:in `each_strongly_connected_component_from'
web_1  |        from /usr/local/lib/ruby/3.0.0/tsort.rb:349:in `block in each_strongly_connected_component'
web_1  |        from /usr/local/lib/ruby/3.0.0/tsort.rb:347:in `each'
web_1  |        from /usr/local/lib/ruby/3.0.0/tsort.rb:347:in `call'
web_1  |        from /usr/local/lib/ruby/3.0.0/tsort.rb:347:in `each_strongly_connected_component'
web_1  |        from /usr/local/lib/ruby/3.0.0/tsort.rb:226:in `tsort_each'
web_1  |        from /usr/local/lib/ruby/3.0.0/tsort.rb:205:in `tsort_each'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/initializable.rb:60:in `run_initializers'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/application.rb:391:in `initialize!'
web_1  |        from /docker-test2/config/environment.rb:5:in `<main>'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
web_1  |        from /usr/local/bundle/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
web_1  |        from /usr/local/bundle/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require'
web_1  |        from /usr/local/bundle/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
web_1  |        from /usr/local/bundle/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `require_relative'
web_1  |        from config.ru:3:in `block in <main>'
web_1  |        from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
web_1  |        from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
web_1  |        from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
web_1  |        from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
web_1  |        from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config'
web_1  |        from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
web_1  |        from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/commands/server/server_command.rb:77:in `log_to_stdout'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/commands/server/server_command.rb:37:in `start'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/commands/server/server_command.rb:144:in `block in perform'
web_1  |        from <internal:kernel>:90:in `tap'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/commands/server/server_command.rb:135:in `perform'
web_1  |        from /usr/local/bundle/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
web_1  |        from /usr/local/bundle/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
web_1  |        from /usr/local/bundle/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/command/base.rb:69:in `perform'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/command.rb:48:in `invoke'
web_1  |        from /usr/local/bundle/gems/railties-6.1.4.1/lib/rails/commands.rb:18:in `<main>'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
web_1  |        from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
web_1  |        from /docker-test2/bin/rails:5:in `<top (required)>'
web_1  |        from /usr/local/bundle/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
web_1  |        from /usr/local/bundle/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
web_1  |        from /usr/local/bundle/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
web_1  |        from /usr/local/bundle/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
web_1  |        from /usr/local/bundle/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
web_1  |        from /usr/local/bundle/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
web_1  |        from /usr/local/bundle/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
web_1  |        from /docker-test2/bin/spring:10:in `require'
web_1  |        from /docker-test2/bin/spring:10:in `block in <top (required)>'
web_1  |        from <internal:kernel>:90:in `tap'
web_1  |        from /docker-test2/bin/spring:7:in `<top (required)>'
web_1  |        from bin/rails:2:in `load'
web_1  |        from bin/rails:2:in `<main>'
docker-test2_web_1 exited with code 1

我發現有人說我必須先安裝 webpacker 所以我嘗試了這樣的事情。docker-compose run web bundle exec rails webpacker:install和錯誤說

Yarn not installed. Please download and install Yarn from https://yarnpkg.com/lang/en/docs/install/ Exiting!

我想我應該在影像中安裝紗線,所以我也嘗試過docker run web shapt-get install yarn但沒有任何改變。

如果您能幫助我,我將不勝感激。

謝謝你。

uj5u.com熱心網友回復:

  1. 將 Dockerfile 的第 2 行替換為以下內容
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client yarn
  1. docker-compose build

  2. docker-compose run --no-deps web rails webpacker:install

uj5u.com熱心網友回復:

我添加RUN yarn install了 Dockerfile 并且它起作用了,但我仍然有問題。

轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/318707.html

標籤:红宝石 码头工人 ruby-on-rails-3

上一篇:如何查詢按日期過濾的活動記錄?

下一篇:Weblogic14c-webservice-description-name在weblogic-webservices中不是唯一的

標籤雲
其他(123570) Java(13369) Python(12731) C(7545) 區塊鏈(7372) JavaScript(7059) 基礎類(6313) AI(6244) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4120) MySQL(4012) Linux(3394) C語言(3288) C++語言(3117) Java相關(2746) 疑難問題(2699) 單片機工控(2479) Web開發(1951) 網絡通信(1793) 數據庫相關(1767) VB基礎類(1755) PHP(1727) 開發(1646) 系統維護與使用區(1617) .NETCore(1586) 基礎和管理(1579) JavaEE(1566) C++(1527) 專題技術討論區(1515) Windows客戶端使用(1484) HtmlCss(1466) ASP.NET(1428) Unity3D(1354) VCL組件開發及應用(1353) HTML(CSS)(1220) 其他技術討論專區(1200) WindowsServer(1192) .NET技术(1165) 交換及路由技術(1149) 語言基礎算法系統設計(1133) WindowsSDKAPI(1124) 界面(1088) JavaSE(1075) Qt(1074) VBA(1048) 新手樂園(1016) 其他開發語言(947) Go(907) HTML5(901) 新技術前沿(898) 硬件設計(872) 區塊鏈技術(860) 網絡編程(857) 非技術版(846) 一般軟件使用(839) 網絡協議與配置(835) Eclipse(790) Spark(750) 下載資源懸賞專區(743)

熱門瀏覽
  • 【C++】Microsoft C++、C 和匯編程式檔案

    ......

    uj5u.com 2020-09-10 00:57:23 more
  • 例外宣告

    相比于斷言適用于排除邏輯上不可能存在的狀態,例外通常是用于邏輯上可能發生的錯誤。 例外宣告 Item 1:當函式不可能拋出例外或不能接受拋出例外時,使用noexcept 理由 如果不打算拋出例外的話,程式就會認為無法處理這種錯誤,并且應當盡早終止,如此可以有效地阻止例外的傳播與擴散。 示例 //不可 ......

    uj5u.com 2020-09-10 00:57:27 more
  • Codeforces 1400E Clear the Multiset(貪心 + 分治)

    鏈接:https://codeforces.com/problemset/problem/1400/E 來源:Codeforces 思路:給你一個陣列,現在你可以進行兩種操作,操作1:將一段沒有 0 的區間進行減一的操作,操作2:將 i 位置上的元素歸零。最終問:將這個陣列的全部元素歸零后操作的最少 ......

    uj5u.com 2020-09-10 00:57:30 more
  • UVA11610 【Reverse Prime】

    本人看到此題沒有翻譯,就附帶了一個自己的翻譯版本 思考 這一題,它的第一個要求是找出所有 $7$ 位反向質數及其質因數的個數。 我們應該需要質數篩篩選1~$10^{7}$的所有數,這里就不慢慢介紹了。但是,重讀題,我們突然發現反向質數都是 $7$ 位,而將它反過來后的數字卻是 $6$ 位數,這就說明 ......

    uj5u.com 2020-09-10 00:57:36 more
  • 統計區間素數數量

    1 #pragma GCC optimize(2) 2 #include <bits/stdc++.h> 3 using namespace std; 4 bool isprime[1000000010]; 5 vector<int> prime; 6 inline int getlist(int ......

    uj5u.com 2020-09-10 00:57:47 more
  • C/C++編程筆記:C++中的 const 變數詳解,教你正確認識const用法

    1、C中的const 1、區域const變數存放在堆疊區中,會分配記憶體(也就是說可以通過地址間接修改變數的值)。測驗代碼如下: 運行結果: 2、全域const變數存放在只讀資料段(不能通過地址修改,會發生寫入錯誤), 默認為外部聯編,可以給其他源檔案使用(需要用extern關鍵字修飾) 運行結果: ......

    uj5u.com 2020-09-10 00:58:04 more
  • 【C++犯錯記錄】VS2019 MFC添加資源不懂如何修改資源宏ID

    1. 首先在資源視圖中,添加資源 2. 點擊新添加的資源,復制自動生成的ID 3. 在解決方案資源管理器中找到Resource.h檔案,編輯,使用整個專案搜索和替換的方式快速替換 宏宣告 4. Ctrl+Shift+F 全域搜索,點擊查找全部,然后逐個替換 5. 為什么使用搜索替換而不使用屬性視窗直 ......

    uj5u.com 2020-09-10 00:59:11 more
  • 【C++犯錯記錄】VS2019 MFC不懂的批量添加資源

    1. 打開資源頭檔案Resource.h,在其中預先定義好宏 ID(不清楚其實ID值應該設定多少,可以先新建一個相同的資源項,再在這個資源的ID值的基礎上遞增即可) 2. 在資源視圖中選中專案資源,按F7編輯資源檔案,按 ID 型別 相對路徑的形式添加 資源。(別忘了先把檔案拷貝到專案中的res檔案 ......

    uj5u.com 2020-09-10 01:00:19 more
  • C/C++編程筆記:關于C++的參考型別,專供新手入門使用

    今天要講的是C++中我最喜歡的一個用法——參考,也叫別名。 參考就是給一個變數名取一個變數名,方便我們間接地使用這個變數。我們可以給一個變數創建N個參考,這N + 1個變數共享了同一塊記憶體區域。(參考型別的變數會占用記憶體空間,占用的記憶體空間的大小和指標型別的大小是相同的。雖然參考是一個物件的別名,但 ......

    uj5u.com 2020-09-10 01:00:22 more
  • 【C/C++編程筆記】從頭開始學習C ++:初學者完整指南

    眾所周知,C ++的學習曲線陡峭,但是花時間學習這種語言將為您的職業帶來奇跡,并使您與其他開發人員區分開。您會更輕松地學習新語言,形成真正的解決問題的技能,并在編程的基礎上打下堅實的基礎。 C ++將幫助您養成良好的編程習慣(即清晰一致的編碼風格,在撰寫代碼時注釋代碼,并限制類內部的可見性),并且由 ......

    uj5u.com 2020-09-10 01:00:41 more
最新发布
  • 在C#中,如何為Praxedo業務事件附件管理器創建SOAP集成?

    我們使用 Praxedo,需要將其與我們的其他解決方案集成。他們的 API 需要使用 SOAP,而且還需要 MTOM 和基本身份驗證。我們已經成功地與多種服務集成,例如他們的客戶經理。在客戶...

    uj5u.com 2021-10-16 15:47:18 more
  • Weblogic14c-webservice-description-name在weblogic-webservice

    我使用以下注釋將我的無狀態 ejb 公開為 Web 服務:@WebService( name = "MyServicePort", portName = "MyServicePort", serviceName = "MyService",)@SOAPBinding(...

    uj5u.com 2021-10-16 15:45:15 more
  • 如何在docker環境中安裝yarn?

    現在,我正在嘗試在 docker 上為 Ruby on rails 創建環境。我閱讀了一些人撰寫并嘗試過的檔案和一些博客。但是我遇到了錯誤并且無法完成。好像我必須在docker環境中安裝yarn,...

    uj5u.com 2021-10-16 15:40:43 more
  • 如何查詢按日期過濾的活動記錄?

    如何從我的資料庫中選擇僅在 5 月份處于活動狀態的所有學生學生?我在活動記錄檔案中找不到它。我只設法查詢了 5 月份創建的學生,而不是所有學生都激活了....Student.where(st...

    uj5u.com 2021-10-16 15:39:52 more
  • 選擇一個Gradle任務,以便每次運行測驗

    當我第一次運行測驗(方法)時,我有這個選單
    但是如果我從當前選單再次運行這個測驗(第二次或更多次),它將運行我最近運行的任務。所以我需要幫助,如何配置IntelliJ Idea,使IDEA總是...

    uj5u.com 2021-10-16 15:29:58 more
  • cypress上的invoke()方法如果呼叫兩次就不作業了

    我是Cypress的新手,我想用一個已經存在的網頁來實作一些簡單的測驗。我對結果有點困惑,因為我呼叫了兩次invoke():第一次是檢查初始值(0%),第二次是設定一個新的值并檢查變化,但是...

    uj5u.com 2021-10-16 15:28:48 more
  • 用jest和testing-library測驗組件內的一個函式

    我是testing-library和jest的新手,我想測驗組件內部的一個函式,它能改變一個輸入的值。這個組件是一個表單,它的另一個組件是一個輸入。
    export const Form=() => {
    const [n...

    uj5u.com 2021-10-16 15:28:44 more
  • TypeScript通用型將所有的特定型別改為另一種型別

    我試圖想出一種型別,即接受一個物件并將所有型別為number的鍵設定為string。 下面的方法不起作用:...

    uj5u.com 2021-10-16 12:36:47 more
  • 當庫存數量為0時,Recyclerview專案顯示空位

    當我從回應中得到庫存數量為0時,產品不顯示,但產品位置在網格回收器視圖kotlin中顯示空位。我將整個串列傳入配接器,然后通過庫存數量過濾。
    class ProductListAdapter(
    va...

    uj5u.com 2021-10-16 12:36:15 more
  • Android-從另一個片段內的回收器視圖呼叫片段

    我有一個應用程式(Java),原來有5個部分。所有這些都是片段,它們由底部導航中的5個圖示訪問。然而,其中一個部分(Lessons)現在被一個不同的片段所取代,該片段包含一個回收器視圖。在...

    uj5u.com 2021-10-16 12:35:50 more