Docker Community Forums

Share and learn in the Docker community.

Swarm services on separate nodes not communicating

Hello, I’m trying to set up OwnCloud on Docker Swarm with the stack name “oc” using the default overlay network for Swarm. All ports are open on the local network (AWS), and there is shared storage mounted to /efs on all instances.

Since new users can’t upload files, my stack definition below, whose passwords aren’t sensitive, works fine with Docker Swarm on a single node, but when I go to two of them, OwnCloud can’t seem to communicate with services on the other node (DB, Redis). Outside of the container on the other node, I can netcat MariaDB and get into Redis with the CLI by private IP, since the ports are open locally. When I shell into the OwnCloud container on this second node, I can ping the other services by their names, e.g. oc_redis, but I can’t netcat MariaDB or get into Redis with the CLI. Also, for example, when I do “getent host oc_redis” in the container, I get an IP back, but I can’t connect with that either.

I feel like I’m missing something very basic. I thought one could just use the default network, and the service names would be resolvable hostnames across the swarm. I’m at my wits end with this, so anything helps. Thanks.

Stack definition:

version: ‘3’
services:
owncloud:
image: owncloud/server:10.8
#container_name: owncloud_server
#restart: always
ports:
- 80:8080
depends_on:
- mariadb
- redis
environment:
- OWNCLOUD_DOMAIN=localhost:8080
- OWNCLOUD_DB_TYPE=mysql
- OWNCLOUD_DB_NAME=owncloud
- OWNCLOUD_DB_USERNAME=owncloud
- OWNCLOUD_DB_PASSWORD=1VI5itRzkHDMXAev
- OWNCLOUD_DB_HOST=oc_mariadb
- OWNCLOUD_ADMIN_USERNAME=admin
- OWNCLOUD_ADMIN_PASSWORD=APQjnel8MmzJ1FKO
- OWNCLOUD_MYSQL_UTF8MB4=true
- OWNCLOUD_REDIS_ENABLED=true
- OWNCLOUD_REDIS_HOST=oc_redis
healthcheck:
test: [CMD, /usr/bin/healthcheck]
interval: 30s
timeout: 10s
retries: 5
volumes:
- /efs/files:/mnt/data
mariadb:
image: mariadb:10.5
ports:
- 3306:3306
#hostname: oc_mariadb
#container_name: owncloud_mariadb
#restart: always
environment:
- MYSQL_ROOT_PASSWORD=8qJeIlJeJVQJT4O/
- MYSQL_USER=owncloud
- MYSQL_PASSWORD=1VI5itRzkHDMXAev
- MYSQL_DATABASE=owncloud
command: “–max-allowed-packet=128M --innodb-log-file-size=64M”
healthcheck:
test: [CMD, mysqladmin, ping, -u, root, --password=8qJeIlJeJVQJT4O/]
interval: 10s
timeout: 5s
retries: 5
volumes:
- /efs/mysql:/var/lib/mysql
redis:
image: redis:6
ports:
- 6379:6379
#hostname: oc_redis
#container_name: owncloud_redis
#restart: always
command: “–databases 1”
healthcheck:
test: [CMD, redis-cli, ping]
interval: 10s
timeout: 5s
retries: 5
volumes:
- /efs/redis:/data

The issue was not having an egress rule for the UDP protocol.

1 Like