How to add specific (existing) network to docker-compose.yml?

    • OMV 4.x
    • Resolved
    • How to add specific (existing) network to docker-compose.yml?

      After a generous help of this community :thumbup: I managed to install letsencrypt and working nextcloud and airsonic containers. I'm using docker compose for it. For future installs, what line I have to include in yml file to join new containers to letsencrypt network? For example, if letsencrypt network ID is "23b23jb23j4v2hj34vhj2v3hjv23hj421jh44j23" what line I have to insert in calibre web docker-compose.yml:

      Source Code

      1. ---
      2. version: "2"
      3. services:
      4. calibre-web:
      5. image: linuxserver/calibre-web
      6. container_name: calibre-web
      7. environment:
      8. - PUID=1000
      9. - PGID=1000
      10. - TZ=Europe/London
      11. - DOCKER_MODS=linuxserver/calibre-web:calibre
      12. volumes:
      13. - path to data:/config
      14. - path to calibre library:/books
      15. ports:
      16. - 8083:8083
      17. restart: unless-stopped
      Display All
    • Morlan wrote:

      why don't you just add calibre to your existing docker-compose.yml? Then it's automatically joined in the network.

      Thank you for answer.

      That is OK for images from linuxserver.io. But I docker-compose.yml from developer (seafile) which is not from linuxserver and want to add to my letsencrypt network.

      Source Code

      1. version: '2.0'
      2. services:
      3. db:
      4. image: mariadb:10.1
      5. container_name: seafile-mysql
      6. environment:
      7. - MYSQL_ROOT_PASSWORD=pass # Requested, set the root's password of MySQL service.
      8. - MYSQL_LOG_CONSOLE=true
      9. volumes:
      10. - /srv/dev-disk-by-label-omvdisk1/appdata/seafiledb:/var/lib/mysql # Requested, specifies the path to MySQL data persistent store.
      11. networks:
      12. - seafile-net
      13. memcached:
      14. image: memcached:1.5.6
      15. container_name: seafile-memcached
      16. entrypoint: memcached -m 256
      17. networks:
      18. - seafile-net
      19. seafile:
      20. image: seafileltd/seafile-mc:latest
      21. container_name: seafile
      22. ports:
      23. - "80:80"
      24. - "443:443" # If https is enabled, cancel the comment.
      25. volumes:
      26. - /srv/dev-disk-by-label-a/seafile/shared:/shared # Requested, specifies the path to Seafile data persistent store.
      27. environment:
      28. - DB_HOST=db
      29. - DB_ROOT_PASSWD=pass # Requested, the value shuold be root's password of MySQL service.
      30. - TIME_ZONE=Europe/Berlin # Optional, default is UTC. Should be uncomment and set to your local time zone.
      31. - SEAFILE_ADMIN_EMAIL=email # Specifies Seafile admin user, default is 'me@example.com'.
      32. - SEAFILE_ADMIN_PASSWORD=pass # Specifies Seafile admin password, default is 'asecret'.
      33. - SEAFILE_SERVER_LETSENCRYPT=true # Whether to use https or not.
      34. - SEAFILE_SERVER_HOSTNAME=url # Specifies your host name if https is enabled.
      35. depends_on:
      36. - db
      37. - memcached
      38. networks:
      39. - seafile-net
      40. networks:
      41. seafile-net:
      Display All
    • As far as I know nothing stops you from adding all container to one docker-compose.yml regardless of the origin.
      But if you want to use separate files it's advisable to join your containers to a use created network.
      In cli you enter docker network create insert_name.
      In the docker-compose.yml you add

      Source Code

      1. networks:
      2. default:
      3. external:
      4. name: insert_name
    • Another problem
      I add calibre-web to my older nextcloud-mariadb-letsencrypt yml file and receive errors

      Source Code

      1. ERROR: for letsencrypt Cannot create container for service letsencrypt: Conflict. The container name "/letsencrypt" is already in use by container "9c62da18f85 82c75b404076fa0a96c5e9e396e95a1e60fb27ac3be79dc15b4d9". You have to remove (or rename) that container to be able to reuse that name.
      2. ERROR: for mariadb Cannot create container for service mariadb: Conflict. The container name "/nextclouddb" is already in use by container "762a3e86610d2c8bb8d 4145fd4aed8fd678b4b7cebf935f985b88e3b1a14e0c7". You have to remove (or rename) that container to be able to reuse that name.
      3. ERROR: Encountered errors while bringing up the project.