3

I follow this article (https://blogs.msdn.microsoft.com/jcorioland/2016/04/25/create-a-docker-swarm-cluster-using-azure-container-service/#comment-1015) to setup a swarm docker host cluster. There are 1 master and 2 agents.The good points for this article is to use "-H 172.16.0.5:2375" which creates new containers on "agent" rather than "master" one.

My question is: if I want to make docker-compose.yml work with that, how could I do it? I have tried command like:

docker-compose -H 172.16.0.5:2375 up

But it doesn't work. If I just use:

docker-compose up

Then the containers will be created on master host and I couldn't even use public DNS to visit the website.

Here is the yml file I use for 1 magento & 1 mariadb containers:

version: '2'
services:
  mariadb:
    image: 'bitnami/mariadb:latest'   
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
    ports:
      - '3306:3306' 
    volumes:
      - 'mariadb_data:/bitnami/mariadb'
  magento:
    image: 'bitnami/magento:latest' 
    environment:
      - MAGENTO_HOST=172.16.0.5
      - MARIADB_HOST=172.16.0.5    
    ports:
      - '80:80' 
    volumes:
      - 'magento_data:/bitnami/magento'
      - 'apache_data:/bitnami/apache'
      - 'php_data:/bitnami/php'
    depends_on:
      - mariadb
volumes:
  mariadb_data:
    driver: local
  magento_data:
    driver: local
  apache_data:
    driver: local
  php_data:
    driver: local

And this section is from my guess based on that article,

    environment:
      - MAGENTO_HOST=172.16.0.5
      - MARIADB_HOST=172.16.0.5   

but yml doesn't like port appended, e.g.

    environment:
      - MAGENTO_HOST=172.16.0.5:2375
      - MARIADB_HOST=172.16.0.5:2375

Thanks a lot!

Samuel
  • 631
  • 1
  • 10
  • 26

0 Answers0