A
A
Arsen Abakarov2017-03-14 20:14:41
Docker
Arsen Abakarov, 2017-03-14 20:14:41

Two different doke-compose instances?

There are two directories, one for running the database, the other for running the web application, how to link the application with the database? For example, through depends_on ..
I don’t want to touch External_links, it is tied to the container, as far as I know
. I tried to do it through networks, but I didn’t understand how to handle it ..
DB:

version: '2'
services:
    mysql:
        image: mysql:5.7
        environment:
            - MYSQL_ROOT_PASSWORD=root
        volumes:
            - ./data/mysql_db:/var/lib/mysql
        ports:
            - "33060:3306"

Appendix:
version: '2'
services:
    redmine:
        image: redmine:3.3.2
        ports:
          - 8080:3000
        environment:
          REDMINE_DB_MYSQL: mysql
          REDMINE_DB_PASSWORD: root
        volumes:
            - ./data/redmine:/usr/src/redmine/files

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
maxclax, 2017-03-17
@maxclax

version: '2'

services:

  redmine:
    image: redmine
    ports:
      - 8080:3000
    environment:
      REDMINE_DB_MYSQL: db
      REDMINE_DB_PASSWORD: example
    depends_on:
      - db
    restart: always

  db:
    image: mariadb
    environment:
      MYSQL_ROOT_PASSWORD: example
      MYSQL_DATABASE: redmine
    restart: always

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question