<p>Indentation looks incorrect...Docker Composerize can help you: <a href="https://www.composerize.com" rel="nofollow noreferrer">https://www.composerize.com</a></p>
<pre><code>version: '3.3'
services:
    fritzbox_smarthome_exporter:
        container_name: fritzbox_smarthome_exporter
        ports:
            - '9103:9103'
        volumes:
            - ${PWD}/boxcert.cer:/fritzbox.pem:ro
        environment:
            PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
            PASSWORD: ChefsPassWord
            USERNAME: chef
        labels:
            - 'http://fritz.box'
        image: jaymedh/fritzbox_smarthome_exporter
        restart: unless-stopped
</code></pre>

CC BY-SA 4.0
2023-10-16T18:46:51.257Z
why does this list "true" twice as environment variables?
Jesusaur
CC BY-SA 4.0
2023-10-16T19:42:15.003Z
@Jesusaur good catch; I updated the docker-compose.yml...I had copied it from output at www.coposerize.com based on OP question's syntax.
mikequentel
CC BY-SA 4.0
2023-10-16T18:33:37.703Z
2023-10-16T19:50:06.587Z
2023-10-16T19:50:06.587Z
mikequentel
<p>The format of your environment variables is incorrect. Additionally, using bash expansion for the volume path won't work, but you can use a relative path:</p>
<pre><code>version: '3.8'
services:
  fritzbox_smarthome_exporter:
    image: 'jaymedh/fritzbox_smarthome_exporter:latest'
    restart: unless-stopped
    ports:
      - '9103:9103'
    environment:
      USERNAME: Chef
      PASSWORD: cHefsPw
      PATH: &quot;/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&quot;
    volumes: 
      - ./boxcert.cer:/fritzbox.pem:ro
    command: &quot;noverify=false url=http://192.168.0.2 cert=/fritzbox.pem&quot;
</code></pre>
<p>You can read more about the docker compose file syntax <a href="https://docs.docker.com/compose/compose-file/compose-file-v3/#environment" rel="nofollow noreferrer">in the official docs</a></p>

CC BY-SA 4.0
2023-10-17T08:00:01.010Z
Hello,
unfortunately that still doesn't work. I get the following error:
failed to deploy a stack: validating /data/compose/40/docker-compose.yml: services.fritzbox_smarthome_exporter must be a mapping
VaraBiker
CC BY-SA 4.0
2023-10-17T16:23:33.703Z
@VaraBiker whoops, sorry, my indentation was incorrect, but I've fixed it.
Jesusaur
CC BY-SA 4.0
2023-10-16T18:46:17.207Z
2023-10-17T16:22:26.280Z
2023-10-17T16:22:26.280Z
Jesusaur
<p>I'm still a newbie in the Docker area. I'm just getting confused about this from this Docker-run command:</p>
<pre class="lang-bash prettyprint-override"><code>docker run -d --name fritzbox_smarthome_exporter -p 9103:9103 \
  -v $(pwd)/boxcert.cer:/fritzbox.pem:ro \
  -e PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
  -e PASSWORD=ChefsPassWord \
  -e USERNAME=chef \
  jaymedh/fritzbox_smarthome_exporter '-noverify=false' '-url=http://fritz.box' '-cert=/fritzbox.pem'
</code></pre>
<p>to create a corresponding <code>docker-compose.yml</code> file.</p>
<p>Can someone enlighten a blind person? Thanks.</p>
<p>This is my design:</p>
<pre class="lang-yaml prettyprint-override"><code>version: '3.8'
services:
  fritzbox_smarthome_exporter:
    image: 'jaymedh/fritzbox_smarthome_exporter:latest'
    restart: unless-stopped
    ports:
      - '9103:9103'
environment:
      USERNAME=Chef
      PASSWORD=cHefsPw
      PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
volumes: 
      - $(pwd)/boxcert.cer:/fritzbox.pem:ro
command: noverify=false url=http://192.168.0.2 cert=/fritzbox.pem
</code></pre>
<p>But Portainer throws the following error message:</p>
<pre><code>failed to deploy a stack: validating /data/compose/25/docker-compose.yml: services.fritzbox_smarthome_exporter1.environment must be a mapping
</code></pre>
<p>Even if I replace the variable with the regular path on the system ( <code>- /opt/fritz_smarthome_exporter/boxcert.cer:/fritzbox.pem:ro</code> ), I get an error.</p>
<pre class="lang-yaml prettyprint-override"><code>version: '3.8'
services:
  fritzbox_smarthome_exporter:
    image: 'jaymedh/fritzbox_smarthome_exporter:latest'
    restart: unless-stopped
    ports:
      - '9103:9103'
environment:
      USERNAME=Chef
      PASSWORD=cHefsPw
      PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
volumes: 
      - /opt/fritbox_smarthome_exporter/boxcert.cer /fritzbox.pem:ro
command: noverify=false url=http://192.168.0.2 cert=/fritzbox.pem

the Error: failed to deploy a stack: validating /data/compose/38/docker-compose.yml: volumes must be a mapping
</code></pre>
<p>can anyone help me ?</p>

<docker><docker-compose>
Mapping error in Docker Compose
VaraBiker
# Mapping error in Docker Compose

(Asked by: username_0 on 2023-10-16)

I'm still a newbie in the Docker area. I'm just getting confused about this from this Docker-run command:
docker run -d --name fritzbox_smarthome_exporter -p 9103:9103 \
  -v $(pwd)/boxcert.cer:/fritzbox.pem:ro \
  -e PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
  -e PASSWORD=ChefsPassWord \
  -e USERNAME=chef \
  jaymedh/fritzbox_smarthome_exporter '-noverify=false' '-url=http://fritz.box' '-cert=/fritzbox.pem'

to create a corresponding docker-compose.yml file.
Can someone enlighten a blind person? Thanks.
This is my design:
version: '3.8'
services:
  fritzbox_smarthome_exporter:
    image: 'jaymedh/fritzbox_smarthome_exporter:latest'
    restart: unless-stopped
    ports:
      - '9103:9103'
environment:
      USERNAME=Chef
      PASSWORD=cHefsPw
      PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
volumes: 
      - $(pwd)/boxcert.cer:/fritzbox.pem:ro
command: noverify=false url=http://192.168.0.2 cert=/fritzbox.pem

But Portainer throws the following error message:
failed to deploy a stack: validating /data/compose/25/docker-compose.yml: services.fritzbox_smarthome_exporter1.environment must be a mapping

Even if I replace the variable with the regular path on the system ( - /opt/fritz_smarthome_exporter/boxcert.cer:/fritzbox.pem:ro ), I get an error.
version: '3.8'
services:
  fritzbox_smarthome_exporter:
    image: 'jaymedh/fritzbox_smarthome_exporter:latest'
    restart: unless-stopped
    ports:
      - '9103:9103'
environment:
      USERNAME=Chef
      PASSWORD=cHefsPw
      PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
volumes: 
      - /opt/fritbox_smarthome_exporter/boxcert.cer /fritzbox.pem:ro
command: noverify=false url=http://192.168.0.2 cert=/fritzbox.pem

the Error: failed to deploy a stack: validating /data/compose/38/docker-compose.yml: volumes must be a mapping

can anyone help me ?

**Tags:** docker, docker-compose


---

## 2 answers

### Answer by username_1 on 2023-10-16. Score: 0

Indentation looks incorrect...Docker Composerize can help you: https://www.composerize.com
version: '3.3'
services:
    fritzbox_smarthome_exporter:
        container_name: fritzbox_smarthome_exporter
        ports:
            - '9103:9103'
        volumes:
            - ${PWD}/boxcert.cer:/fritzbox.pem:ro
        environment:
            PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
            PASSWORD: ChefsPassWord
            USERNAME: chef
        labels:
            - 'http://fritz.box'
        image: jaymedh/fritzbox_smarthome_exporter
        restart: unless-stopped

> **Comments:**
> **username_2**: why does this list "true" twice as environment variables?  
> **username_1**: @username_2 good catch; I updated the docker-compose.yml...I had copied it from output at www.coposerize.com based on OP question's syntax.  

---

### Answer by username_2 on 2023-10-16. Score: 0

The format of your environment variables is incorrect. Additionally, using bash expansion for the volume path won't work, but you can use a relative path:
version: '3.8'
services:
  fritzbox_smarthome_exporter:
    image: 'jaymedh/fritzbox_smarthome_exporter:latest'
    restart: unless-stopped
    ports:
      - '9103:9103'
    environment:
      USERNAME: Chef
      PASSWORD: cHefsPw
      PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
    volumes: 
      - ./boxcert.cer:/fritzbox.pem:ro
    command: "noverify=false url=http://192.168.0.2 cert=/fritzbox.pem"

You can read more about the docker compose file syntax in the official docs

> **Comments:**
> **username_0**: Hello, unfortunately that still doesn't work. I get the following error: failed to deploy a stack: validating /data/compose/40/docker-compose.yml: services.fritzbox_smarthome_exporter must be a mapping  
> **username_2**: @username_0 whoops, sorry, my indentation was incorrect, but I've fixed it.  

---

