Docker Community Forums

Share and learn in the Docker community.

Docker compose - add container to dedicated network


I am stuck while trying to create a couple of docker containers and run them within a dedicated network. The idea is (as far as i undersootd) that within this network the containers can talk to each other over their normal ports (like mysql databse on 3306) and that this does not clash with containers or normal software operating on the same ports but not in the same docker-network".

The specific situation is that I have a Linux server and I run seafile ( - opensource cloud solution) on it.
I also run Mailcow via docker in it. mailcow is not in a specific network.

Now I would like to run another instance of seafile via docker. I would use nginx to make that seafile instance available. But I get stuck because when I start the docker-compose file, I get error messages that all the ports are already busy.

ERROR: for seafile-docs-mysql Cannot start service db: b’driver failed programming external connectivity on endpoint seafile-docs-mysql (a4a81e4fe4d747e15f6e4a05f7604513413225e50e594469e828bf1114367d3f): Error starting userland proxy: listen tcp bind: address already in use’

I think i need tp start the conatiners that are combined with the docker-compose in a dedicated network.

But I don’t understand how.

The offical (very very short) manual gives this (from is:

version: '2.0'
image: mariadb:10.3
container_name: seafile-docs-mysql
  - 3306:3306
  - MYSQL_ROOT_PASSWORD=db_dev  # Set the root's password of MySQL service.
  - /opt/mysql-data:/var/lib/mysql  # Specify the data directory of MySQL.

image: memcached:1.4-alpine
container_name: seafile-docs-memcached
  - 11211:11211
image: seafileltd/seafile-docs:latest
container_name: seafile-docs
  - 80:80
#     - 443:443  # If https is enabled, cancel the comment.
  - /opt/seafile-data/:/shared/seafile   # Specifies the path to the seafile data persistent store.
  - DB_HOST=db
  - DB_ROOT_PASSWD=db_dev
  - # Specifies seafile admin user, default is
  - SEAFILE_ADMIN_PASSWORD=asecret     # Specifies seafile admin password, default is asecret
  - SEAFILE_SERVER_LETSENCRYPT=false   # Whether to use https or not
  - # Specifies your host name if https is enabled
  - db
  - memcached

I now want to add something like the below to it. But I don’t understand what I should do,

      - subnet
      - gateway:

But it dows not work. And I don’t think that the containers run in that network.
I really hope that someone understands the issue I have and can point me into the right direction. I am happy to explain more, but I am unsure whaty else to write.

I guess it’s quite simple, but I am too newbie…

Thanks in advance for any help,

KR, Chris