Reputation: 31
I have deployed several workload containers from dockerhub to Rancher. Now I need them connected through a network. How do I go about this? I have a Load balancer set up. I think a network can be set up through load balancer in the Rancher UI?
Currently I have five workloads under one namespace (webapp-9):
webapp-9-apache
webapp-9-php
webapp-9-mysql
webapp-9-solr
webapp-9-phpmyadmin
Following error occurs when pullin up webapp-9-apache workload in browser:
Proxy Error
Reason: DNS lookup failure for: php
Here is my docker-compose.yml:
version: '3.1'
services:
apache:
build:
context: .
dockerfile: path/to/apache/Dockerfile
image: user:webapp-9-apache
ports:
- 80:80
depends_on:
- mysql
- php
volumes:
- ./http:/path/to/web/
php:
build:
context: .
dockerfile: path/to/php/Dockerfile
image: user:webapp-9-php
volumes:
- ./http:/path/to/folder/
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_RANDOM_ROOT_PASSWORD=${MYSQL_RANDOM_ROOT_PASSWORD}
depends_on:
- mysql
mysql:
build:
context: .
dockerfile: path/to/mysql/Dockerfile
image: user:webapp-9-mysql
command: mysqld --sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
ports:
- 3306:3306
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_RANDOM_ROOT_PASSWORD=${MYSQL_RANDOM_ROOT_PASSWORD}
volumes:
- ./data:/path/to/mysql
- .docker/mysql/config:/path/to/conf.d
solr:
build:
context: .
dockerfile: path/to/Dockerfile
image: user:webapp-9-solr
ports:
- "8983:8983"
volumes:
- ./solr_data:/path/to/solr
command:
- solr-precreate
- gettingstarted
phpmyadmin:
build:
context: .
dockerfile: path/to/phpmyadmin/Dockerfile
image: user:webapp-9-phpmyadmin
ports:
- 8090:80
environment:
- PMA_HOST=mysql
- PMA_PORT=3306
- PMA_USER=${MYSQL_USER}
- PMA_PASSWORD=${MYSQL_PASSWORD}
- UPLOAD_LIMIT=200M
Upvotes: 0
Views: 76
Reputation: 31
All workloads need to be under the same Namespace (which they already were) and the workloads need to be named according to the services in the docker-composer.yml file. e.g. drupal-9-spintx-php -> php
Upvotes: 0