Docker Compose with Rails挂断命令

时间:2017-02-14 20:38:19

标签: ruby-on-rails windows docker docker-compose

我通过https://docs.docker.com/compose/rails/#build-the-project(使用Windows 10 Home)关注Docker Rails教程

编辑:请注意,我正在使用 docker-toolbox ,因为Docker需要Windows 10 Pro for Hyper-V,而且我有Windows 10家庭版。

我已多次浏览本教程,每次运行docker-compose时,都会挂起并且没有提及应用程序运行的本地端口。我还尝试制作一个新应用并更改docker-compose.yml中的端口号,看看是否能解决问题。

本教程中的所有先前命令都已正常工作,并且在运行docker-compose up命令之前,我已正确编辑了config / database.yml文件。

我删除了图片和所有文件,并从头开始几次。我仍然遇到同样的问题。

以下是教程中的命令:

docker-compose run web rails new . --force --database=postgresql --skip-bundle

docker-compose build

docker-compose up

docker-compose run web rails db:create

这是我的docker-compose.yml文件:

version: '2'
services:
  db:
    image: postgres
  web:
    build: .
    command: bundle exec rails s -p 3000 -b '0.0.0.0'
    volumes:
      - .:/myapp
    ports:
      - "3000:3000"
    depends_on:
      - db

这是我的Dockerfile:

FROM ruby:2.3.3
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev    nodejs
RUN mkdir /myapp
WORKDIR /myapp
ADD Gemfile /myapp/Gemfile
ADD Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
ADD . /myapp

以下是docker-compose的输出:

$ docker-compose up
mydockerbuild_db_1 is up-to-date
Creating mydockerbuild_web_1
Attaching to mydockerbuild_db_1, mydockerbuild_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 default max_connections ... 100
db_1   | selecting default shared_buffers ... 128MB
db_1   | selecting dynamic shared memory implementation ... posix
db_1   | creating configuration files ... ok
db_1   | running bootstrap script ... ok
db_1   | performing post-bootstrap initialization ... ok
db_1   |
db_1   | 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   | syncing data to disk ... ok
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   | ****************************************************
db_1   | WARNING: No password has been set for the database.
db_1   |          This will allow anyone with access to the
db_1   |          Postgres port to access your database. In
db_1   |          Docker's default configuration, this is
db_1   |          effectively any other container on the same
db_1   |          system.
db_1   |
db_1   |          Use "-e POSTGRES_PASSWORD=password" to set
db_1   |          it in "docker run".
db_1   | ****************************************************
db_1   | waiting for server to start....LOG:  database system was shut down    at 2017-02-14 18:56:05 UTC
db_1   | LOG:  MultiXact member wraparound protections are now enabled
db_1   | LOG:  database system is ready to accept connections
db_1   | LOG:  autovacuum launcher started
db_1   |  done
db_1   | server started
db_1   | ALTER ROLE
db_1   |
db_1   |
db_1   | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-  initdb.d/*
db_1   |
db_1   | LOG:  received fast shutdown request
db_1   | LOG:  aborting any active transactions
db_1   | LOG:  autovacuum launcher shutting down
db_1   | LOG:  shutting down
db_1   | waiting for server to shut down....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   | LOG:  database system was shut down at 2017-02-14 18:56:06 UTC
db_1   | LOG:  MultiXact member wraparound protections are now enabled
db_1   | LOG:  database system is ready to accept connections
db_1   | LOG:  autovacuum launcher started
db_1   | LOG:  received smart shutdown request
db_1   | LOG:  autovacuum launcher shutting down
db_1   | LOG:  shutting down
db_1   | LOG:  database system is shut down
db_1   | LOG:  database system was shut down at 2017-02-14 19:06:12 UTC
db_1   | LOG:  MultiXact member wraparound protections are now enabled
db_1   | LOG:  database system is ready to accept connections
db_1   | LOG:  autovacuum launcher started
db_1   | ERROR:  database "myapp_development" already exists
db_1   | STATEMENT:  CREATE DATABASE "myapp_development" ENCODING =   'unicode'
db_1   | ERROR:  database "myapp_test" already exists
db_1   | STATEMENT:  CREATE DATABASE "myapp_test" ENCODING = 'unicode'
db_1   | ERROR:  database "myapp_development" already exists
db_1   | STATEMENT:  CREATE DATABASE "myapp_development" ENCODING = 'unicode'
db_1   | ERROR:  database "myapp_test" already exists
db_1   | STATEMENT:  CREATE DATABASE "myapp_test" ENCODING = 'unicode'
db_1   | ERROR:  database "myapp_development" already exists
db_1   | STATEMENT:  CREATE DATABASE "myapp_development" ENCODING = 'unicode'
db_1   | ERROR:  database "myapp_test" already exists
db_1   | STATEMENT:  CREATE DATABASE "myapp_test" ENCODING = 'unicode'

0 个答案:

没有答案