Help with docker compose reddit / selfhosted ---------------------------------------------------------------------- Anxious_Device888 · 2023-10-09 13:03 Hello everyone, I am a newbie to selfhosting and I am trying to read up multiple posts here first before I go ahead and start setting up the applications using docker compose. Thanks to a few other recent posts around how to organise the compose set-up, and I am looking at below folder structure. My hope is that this will allow me to have a CI/CD type setup (just with shell scripts, nothing complicated) to keep updating my compose files, as I try to build up my set-up. One issue I am facing right now is seemingly with the "include" in docker compose, and most answers on stackoverflow, other selfhosted posts all point to the version in the conpose file, however my version number is already updated. What other things am I missing / should be looking into? Like I said I am a newbie, so highly appreciate any suggestions you can point me to I am trying to bring up the stack with - "sudo docker-compose up -d" from within the project. Error I see - ``` ERROR: Version in "./docker-compose.yaml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1. For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/ ``` My files are like this - docker-compose.yml (parent) ``` version: "3.8" include: - path: 'docker/pihole/docker-compose.yaml' - path: 'docker/caddy/docker-compose.yaml' ``` The folder structure is - project/ ├──pihole │ └── docker-compose.yaml ├──caddy │ └── docker-compose.radarr.yml └── .env └── docker-compose.yml data/ └── pihole/ │ └── ... └── caddy/ │ └── ... ---------------------------------------------------------------------- borouhin · 2023-10-09 13:17 You're probably running an older version of docker-compose, you need 2.20+ to use include top-level statements (and it's "docker compose" instead of "docker-compose" now). ---------------------------------------------------------------------- Anxious_Device888 · 2023-10-09 14:58 Thanks for that @borouhin. Reading more about docker compose vs docker-compose - you might be right. I am on ubuntu 20.04 and the usual apt update / upgrade doesnt show any new updates available for docker. Looks like I will have to install directly using docker repo, as mentioned on their website, instead of using the version from apt (which is what i did). ---------------------------------------------------------------------- borouhin · 2023-10-09 15:03 Even on Ubuntu 22.04 built-in repository contains a pretty outdated version of docker. You need to uninstall old packages (as package names have changed as well) and install the new ones from docker repository. It's all covered in detail [in the documentation](https://docs.docker.com/engine/install/ubuntu/). ---------------------------------------------------------------------- thekrautboy · 2023-10-09 16:00 The fact that youre using `docker-compose` is a clear sign your Docker installation is quite a bit out of date. I would suggest you uninstall it completely and then follow the Docker docs to install it fresh from their repo. Also /r/Docker is the ideal sub for things like this. ---------------------------------------------------------------------- Anxious_Device888 · 2023-10-09 23:00 Thanks u/borouhin and u/thekrautboy for your suggestions !. I have upgraded to the latest docker version from docker repository and the errors about include are now gone. I am running into another issue now. In the single docker-compose.yaml version (all apps in one compose file) I am able to use yaml anchors to reuse repeating bits like ``` x-dns-always-start: &x-dns-always-start dns: "10.0.1.10" restart: "always" ``` and use them in each service to keep the file cleaner. However when I try the same with the parent / child docker- compose.yaml set-up, I see this error when trying 'docker compose up' ``` parsing docker/caddy/docker-compose.yaml: yaml: unknown anchor 'x-dns- always-start' referenced ``` Does this mean I cannot use the yaml anchors in the child docker- compose.yaml files ? Is there any other way to reduce the repeating code/configs in the yaml files ? Thanks for your suggestions everyone ! ---------------------------------------------------------------------- thekrautboy · 2023-10-09 23:02 > Also /r/Docker is the ideal sub for things like this.