Docker compose build error - ‘environment must be a mapping’

I hope that I am posting this in the right spot…

‘Google’ is failing me and I have spent the better part of the day so far trying to figure out what I am sure is a fairly simple fix.

I am working in Portainer trying to create a Stack and I have been working through numerous errors that it throws my way…not to be unexpected seeing how new I am to this. The one I am stuck on, as noted in the subject, is the volume paths.

Below is a snippet of what I am trying to do;

---
version: "2.15"
services:
  
## Players

  jellyfin:
    image: lscr.io/linuxserver/jellyfin:lastest
    container_name: jellyfin
    environment:
      PUID=1000
      PGID=1000
      TZ=America/Edmonton
    network_mode: 'bridge'
    volumes:
     - C:\Users\username\docker\configs\jellyfin\cache:/cache
     - C:\Users\username\docker\\configs\jellyfin\config:/config
     - D:\TV:/tvshows:ro
     - D:\Movies:/movies:ro
     - E:\Movies:/movies2:ro
    ports:
      - 8096:8096
    restart: unless-stopped

OS: Windows 10 Pro
Docker: 4.6.13

Thanks in advance!

That is the version of Docker Desktop. Docker (CE) and Docker Desktop are not the same. Docker Desktop contains Docker CE.

If you mean services must be a mapping what does that have to do with the volume paths?

The error message refers to that services is not a mapping, although it looks like that for me. Is it the whole compose file?

My apologies…still getting familiar with all the terminology.

In reverse order of your question, no that is not the entire compose file, however, I snipped it because I know it is erroring out on the first part of the stack. Here is the actual error;

“failed to deploy a stack: services.jellyfin.environment must be a mapping”

As I read that again, its referring to ‘environment’, not ‘volumes’

Oh I see… You forgot to use dashes before the environment variables.

You have to ways to define neironment variables.

As a list:

    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/Edmonton

or as a mapping

    environment:
      PUID: 1000
      PGID: 1000
      TZ: America/Edmonton

So the error message was not precise, but I also prefer the mapping style.

PS.: I moved the topic to the Compose category and fixed the topic title.

2 Likes

Thank you Sir…that cleared that up! Fixed all the references and tried to deploy the stack again. Now I get the following error;

failed to deploy a stack: jellyfin Pulling jellyfin Error Error response from daemon: manifest unknown

I guess because you refer to “lastest” and not “latest” in the image name.

1 Like

If we ever meet…I owe you a coffee! Its deploying now.

I guess one should step away from the computer for a while when you’ve been at things for 6 hours!

1 Like

That is absolutely true. I am glad it works now.

1 Like