Mysql2::Error: Unknown MySQL server host 'expvipdb'

800 views
Skip to first unread message

Michał T. Lorenc

unread,
Aug 2, 2018, 1:53:34 AM8/2/18
to Ruby on Rails: Talk
Hi,

I used docker-compose up and it gave me Mysql2::Error: Unknown MySQL server host 'expvipdb' (-2) with the following docker-compose.yml file:


    expvip:
        build: .
        restart: always
        ports:
            - "80:80"
        links:
            - expvipdb
            - exvip_mongo
        volumes:
            - ./data/:/db
    
    expvipdb:
      image: mariadb
      restart: always
      environment:
        - MYSQL_ROOT_PASSWORD=admin
        - MYSQL_DATABASE=expvip
        - MYSQL_USER=expvipUSR
        - MYSQL_PASSWORD=expvipPWD
      ports:
        - "3306:3306"
      volumes:
        - ./mysql/:/docker-entrypoint-initdb.d
    
    phpmyadmin:
      image: phpmyadmin/phpmyadmin
      restart: always
      links:
        - expvipdb
      ports:
        - 8183:80
      environment:
        PMA_USER: root
        PMA_PASSWORD: admin
        PMA_ARBITRARY: 1
    
    exvip_mongo:
        image: mongo
        restart: always
        ports:
          - 27017:27017
        volumes:
          - ./mongo/:/mongo

and the Dockerfile for exvip looks like this:

    FROM debian:stretch-backports
    RUN apt-get update  && apt-get install -y --no-install-recommends \
            build-essential \
            ruby ruby-dev \
            curl wget \
            gnupg \
            git \
            ncbi-blast+ \
            libmariadbclient-dev \
            libsqlite3-dev \
            zlib1g-dev && \
            apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
    
    RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \
            apt-get update  && apt-get install -y --no-install-recommends \
            nodejs npm && \
            apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
    
    ENV EXPVIP_VERSION Release-2018-07-17
    
    RUN git clone -b load_preferences_file https://github.com/homonecloco/expvip-web.git  && \
        cd expvip-web && \
        sed -i.bak "s|localhost|expvipdb|" config/database.yml && \
        sed -i.bak "s|:num_threads: 1|:num_threads: 4|" config/sequenceserver.conf && \
        sed -i.bak "s|/Volumes/homonecloco/References|/db|" config/sequenceserver.conf && \
        gem install bundler && \
        bundle install && \
        rake db:migrate



    default: &default
      adapter: mysql2
      encoding: utf8
      database: expvipdb
      username: expvipUSR
      password: expvipPWD
      host: expvipdb
      port: 3306
    
    development:
      <<: *default
      database: "wheat_expression_dev"
    #  database: "expvip_berries"
    # Warning: The database defined as "test" will be erased and
    # re-generated from your development database when you run "rake".
    # Do not set this db to the same as development or production.
    test:
      <<: *default
      database: "wheat_expression_test"
    
    #production:
    #  <<: *default
    #  database: "wheat_expression_prd"
    
    #production:
    #  <<: *default
    #  database: db/production.sqlite3

What did I miss?

Thank you in advance

Michal

Walther Diechmann

unread,
Aug 2, 2018, 2:00:11 AM8/2/18
to Ruby
my docker-compose’s always have

networks:
db:
web:

and my containers always identify the networks like:

services:
expvip:
networks:
- web
- db

expvipdb:
networks:
- db

not sure if that helps?


cheers,
Walther
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0e051df5-2a66-49a4-9369-07cff408bf2d%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> Denne besked er blevet skannet af
> ALCO Mailscan, og menes at være fri for vira og spam. mener du at det er en spam mail er du velkomme til at trykker pålinket herunder.
>
> Klik her for at rapportere denne besked som spam.

Reply all
Reply to author
Forward
0 new messages