Hassio & docker-compose, Add foring containers to the hassio network

Just started with Docker and found the Linuxserver containers + docker-compose.
Does somebody know how I add the network within docker compose? (used portainer to add an container to the network so far)
I got the feeling that I’m close…

---
version: "2"
networks:
  default:
    external:
      name: hassio
services:
  mariadb:
    image: linuxserver/mariadb
    container_name: mariadb
#    networks:
 #     - hassio
    environment:
      - PUID=1000
      - PGID=1000
      - MYSQL_ROOT_PASSWORD=lsof23
      - TZ=Europe/London
      - MYSQL_DATABASE=test
      - MYSQL_USER=test
      - MYSQL_PASSWORD=EwACf
    volumes:
      - /usr/share/hassio/share/docker/mariadb-nextcloud/:/config
    ports:
      - 3306:3306
    restart: unless-stopped




thanks in advance


https://github.com/docker/compose/issues/3845#issuecomment-279732773

Got it!

---
version: "2"

networks:
  hassio:
    external:
      name: hassio
services:
  mariadb:
    image: linuxserver/mariadb
    container_name: mariadb
    networks:
      - hassio
    environment:
      - PUID=

Only thing wich is bugging me hard that the container_name cant be used as ‘dns name’ wich get me into troubles with the IP

I guess that it is a problem with my system/config…

Have you tried importing this dockerfile with the portainer UI? Just curious. I was trying to get Homebridge up and running but it’s been abandoned since Homebridge is native now… I just want it for other things and was trying to import it the lazy way.

nope wasnt even aware that this is possible.
would guess that it makes hardly any diffrence.
For portainer its just another stack with limited control.

Just had an chat with MichaelW in the discord server - He suspects an DNS issue, Need to find out more about the used middleware.