Home>
(Host OS) windows10
rails6
ruby2.7
postgresql
UTF-8
I want to start the server with docker and access localhost
"Unable to access this site. Connection refused on localhost."
Will be said.
docker-compose up
Starting myapp_db_1 ... done
Starting myapp_web_1 ... done
Attaching to myapp_db_1, myapp_web_1
db_1 |
db_1 | PostgreSQL Database directory appears to contain a database;Skipping initialization
db_1 |
db_1 | 2020-09-27 09: 05: 55.252 UTC [1] LOG: starting PostgreSQL 13.0 (Debian 13.0-1.pgdg100 + 1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) ) 8.3.0, 64-bit
db_1 | 2020-09-27 09: 05: 55.253 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2020-09-27 09: 05: 55.254 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2020-09-27 09: 05: 55.260 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2020-09-27 09: 05: 55.266 UTC [24] LOG: database system was shut down at 2020-09-27 09:05:46 UTC
web_1 | =>Booting Puma
web_1 | =>Rails 6.0.3.2 application starting in development
web_1 | =>Run `rails server --help` for more startup options
web_1 | Puma starting in single mode ...
web_1 | * Version 4.3.6 (ruby 2.7.1-p83), codename: Mysterious Traveler
web_1 | * Min threads: 5, max threads: 5
web_1 | * Environment: development
web_1 | * Listening on tcp: //0.0.0.0:3000
Probably due to "database system was shut down at 2020-09-27 08:48:28 UTC" but I don't know how to fix it. Please give me some advice.
docker-compose ps
The specified path can not be found.
Name Command State Ports
-------------------------------------------------- -------------------------------
myapp_db_1 docker-entrypoint.sh postgres Up 5432/tcp
myapp_web_1 entrypoint.sh bundle exec ... Up 0.0.0.0:3000->3000/tcp
FROM ruby: 2.7.1
RUN apt-get update -qq&&apt-get install -y nodejs postgresql-client
RUN apt-get update&&apt-get install -y curl apt-transport-https wget&&\
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add-&&\
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list&&\
apt-get update&&apt install -y yarn
RUN curl -sL https://deb.nodesource.com/setup_7.x | bash-&&\
apt-get install nodejs
RUN mkdir/myapp
WORKDIR/myapp
COPY Gemfile/myapp/Gemfile
COPY Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
COPY./Myapp
# 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"]
version: '3'
services: services:
db:
image: postgres
volumes:
--web_postgre:/var/lib/postgresql/data
environment: environment:
POSTGRES_PASSWORD: 3246xkxh
web:
build: ..
command: ["bundle", "exec", "rails", "s", "-p", "3000", "-b", "0.0.0.0"]
volumes:
--.:/Myapp
ports: ports:
-"3000: 3000"
depends_on:
--db
volumes:
web_postgre:
external: true
-
Answer # 1
-
Answer # 2
if,
web_postgre
If you don't have the data you need inside
Wouldn't it improve if you delete the contents and restart it?docker-compose down -v rm -rf web_postgre docker-compose up
Reference: docker-compose down | Docker documentation
If this improves,
For some reasonweb_postgre
It is possible that the data in was in an abnormal state.
Related articles
- ruby - unable to access server with rails s
- ruby - rails unable to resolve user errors
- ruby on rails - access fails after seed after deploying to heroku
- ruby on rails 6 - even if i look at routesrb, i do not know which url to access to display the screen
- ruby - unable to create rails model (environment: cloud9)
- ruby on rails - rails can't connect to localhost
- ruby - [rails] unable to resolve "name error in affiliates controller # show" error
- ruby on rails - unable to start server in aws production environment
- ruby on rails - can't access rails server
- ruby on rails - unable to get latitude/longitude from user registration
- ruby on rails - unable to install direnv
- ruby - unable to open rails server
- ruby - unable to save comments in db (rails)
- ruby on rails - unable to create controller
- ruby on rails - when i access the rails 6 site on heroku with my own domain, it says "this connection does not protect priv
- ruby - aws access denied for user'hoge' @'localhost' (using password: no)
- ruby on rails 5 - transaction exception handling doesn't work
- ruby on rails - nomethoderror in itemscontroller # new error
- ruby - use form_with in rails to specify multiple models and save values
Related questions
- ruby - unable to create table with foreign key
- ruby on rails - i'm trying to build a rails environment on docker, but it doesn't work
- array - about the tag search function in ransack when i press the submit button, an error occurs
- ruby - asynchronous communication 500 (internal server error)
- ruby - [rails6] i get an error on heroku when i write
- mysql - questions about docker errors
- ruby on rails - [rails] chat function is being implemented jserb file cannot be read
- ruby - i want to build a rails environment on docker, but i can't get an error
- error in javascript_pack_tag
- mysql - i want to recreate rails db from scratch
For docker toolbox
Check the IP address with
http: //
Should have done
Instead, I got the error Webpacker :: Manifest :: MissingEntryError. I have another question.