Incorrect type - expected integer - but it works

Hi all,

Got something triggering my OCD a little. Currently have a bit of a Interpolation fetish going and have been moving as many values as I can into the .env file. It has been working great - for environment variables, container name, image tag, ports (short syntax), secrets, etc, etc. But I have just done it with my Traefik3 container, which is the only one where I use ports in a long syntax form, and am getting yaml warning, ‘Incorrect type. Expected “integer”.yaml-schema: docker-compose.yml’. This is when writing out the compose file in code-server. But when I actually run the compose file Traefik loads up just fine with the correct ports allocated. Is this some error with code-server, or have I coded it wrong here, or what? It works, so should I just ignore and go about my day?

Screenshot of warning and the interpolation I used:

.env file port segments look like this:

What you observe is a limitation of the used code server extension. It ignores the .env file and validates the yaml file directly against the compose file schema as is.

Docker compose on the other hand interpolates the variables with values from the .env file before validating and deploying the resources.

1 Like