WSL2
docker-compose:version 1.29.2
Error: Database is uninitialized and superuser password is not specified. You must specify POSTGRES_PASSWORD to a non-empty value for the superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run". You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all connections without a password. This is *not* recommended. See PostgreSQL documentation about "trust": https://www.postgresql.org/docs/current/auth-trust.html
試したこと
・docker-compose.ymlに、
environment: POSTGRES_PASSWORD: 'postgres'
これを追加しました
これでも動かなかったため非推奨である
environment: POSTGRES_HOST_AUTH_METHOD: 'trust'
これを追加しました。
docker-compose.yml編集後はbuildしておりません。Dockerfile,Gemfile編集後はビルドし直すことと認識しています。
7件ぐらい環境構築サイト試しましたがどれも無理でした。なので少々古いですがDocker公式ドキュメントに沿った環境構築を参照しております。
FROM ruby:2.6.5 RUN apt-get update -qq && apt-get install -y nodejs postgresql-client RUN mkdir /rails-docker10 WORKDIR /rails-docker10 COPY Gemfile /rails-docker10/Gemfile COPY Gemfile.lock /rails-docker10/Gemfile.lock RUN bundle install COPY . /rails-docker10 # 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"]

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。