0

hier sind meine Konfigurationen:Verbindung abgelehnt für Docker Entwicklungsumgebung

docker-compose.yml

--- 
web: 
    build: . 
    command: RAILS_ENV=production bundle exec rake assets:precompile --trace 
    command: foreman start 
    ports: 
    - "3000:3000" 
    links: 
    - postgres 
    environment: 
    - RAILS_ENV=production 
    - RACK_ENV=production 
    - POSTGRES_DATABASE=postgres 
    - POSTGRES_USERNAME=postgres 
    - POSTGRES_HOST=db 
postgres: 
    image: postgres 

Procfile

web: bundle exec puma -e _env:RAILS_ENV -C config/puma.rb 
nginx: /usr/sbin/nginx -g 'daemon off;' 

Dockerfile

# Generated by Cloud66 Starter 
FROM ruby:2.2.3 

RUN apt-get update -qq && apt-get install -y build-essential 
RUN apt-get -y install curl \ 
       git \ 
       imagemagick \ 
       libmagickwand-dev \ 
       libcurl4-openssl-dev \ 
       nodejs \ 
       postgresql-client 

# Installing your gems this way caches this step so you dont have to reintall your gems every time you rebuild your image. 
# More info on this here: http://ilikestuffblog.com/2014/01/06/how-to-skip-bundle-install-when-deploying-a-rails-app-to-docker/ 
# Copy the Gemfile and Gemfile.lock into the image. 
# Temporarily set the working directory to where they are. 
WORKDIR /tmp 
ADD Gemfile Gemfile 
ADD Gemfile.lock Gemfile.lock 
RUN gem install bundler 
RUN bundle install 

# Install and configure nginx 
RUN apt-get install -y nginx 
RUN rm -rf /etc/nginx/sites-available/default 
ADD config/nginx.conf /etc/nginx/nginx.conf 

# Add our source files precompile assets 
ENV APP_HOME /app 
RUN mkdir -p $APP_HOME 
WORKDIR $APP_HOME 
ADD . $APP_HOME 
# RUN RAILS_ENV=production bundle exec rake assets:precompile --trace 

Ich baue Docker-Container mit docker-compose und war erfolgreich:

docker-compose build 

Und hier ist Ausgang für docker-compose up

docker-compose up 

⇒ docker-compose up 
Starting watchhound_postgres_1 
Starting watchhound_web_1 
Attaching to watchhound_postgres_1, watchhound_web_1 
postgres_1 | LOG: database system was interrupted; last known up at 2016-06-24 08:58:25 UTC 
postgres_1 | LOG: database system was not properly shut down; automatic recovery in progress 
postgres_1 | LOG: invalid record length at 0/1707C48 
postgres_1 | LOG: redo is not required 
postgres_1 | LOG: MultiXact member wraparound protections are now enabled 
postgres_1 | LOG: database system is ready to accept connections 
postgres_1 | LOG: autovacuum launcher started 
web_1  | 09:04:46 web.1 | started with pid 6 
web_1  | 09:04:46 nginx.1 | started with pid 7 
web_1  | 09:04:47 web.1 | [6] Puma starting in cluster mode... 
web_1  | 09:04:47 web.1 | [6] * Version 3.4.0 (ruby 2.2.3-p173), codename: Owl Bowl Brawl 
web_1  | 09:04:47 web.1 | [6] * Min threads: 5, max threads: 5 
web_1  | 09:04:47 web.1 | [6] * Environment: _env:RAILS_ENV 
web_1  | 09:04:47 web.1 | [6] * Process workers: 1 
web_1  | 09:04:47 web.1 | [6] * Phased restart available 
web_1  | 09:04:47 web.1 | [6] * Listening on tcp://0.0.0.0:5000 
web_1  | 09:04:47 web.1 | [6] * Listening on unix:///var/run/puma.sock 
web_1  | 09:04:47 web.1 | [6] Use Ctrl-C to stop 
web_1  | 09:04:49 web.1 | [6] - Worker 0 (pid: 12) booted, phase: 0 

PROBLEM

Alles sieht gut aus, aber wenn ich Besuch 192.168.99.100:5000 (von docker-machine ip) Der Browser sagt 192.168.99.100 refused to connect

nicht sicher, was ich

Antwort

0

Mein Problem war, mit docker-compose.yml Datei, müssen binden Port 5000 nicht 3000 als pro meine Gesamtkonfiguration bin fehlt.

Verwandte Themen