Skip to content

referencing accessories by container name? #673

Answered by acidtib
gammons asked this question in Q&A
Discussion options

You must be logged in to vote

@gammons This can be achieved if you run the web app and accessory on the same server, create a docker network on the server, then define the network on deploy.yml

create a network on the server
docker network create -d bridge private

set server and accessory network config

servers:
  web:
    hosts:
      - xx.xx.xx.xx
    options:
      network: "private"
accessories:
  db:
    image: mariadb:latest
    host: xx.xx.xx.xx
    port: 3306
    env:
      clear:
        MYSQL_ROOT_HOST: '%'
      secret:
        - MYSQL_ROOT_PASSWORD
        - MYSQL_USER
        - MYSQL_PASSWORD
        - MYSQL_DATABASE
    options:
      network: "private"
    directories:
      - data:/var/lib/mysql

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gammons
Comment options

Answer selected by gammons
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants