# Trying to run Firefox on Pi with exec node and SSH - Error: no DISPLAY environment variable specified

**URL:** https://discourse.nodered.org/t/trying-to-run-firefox-on-pi-with-exec-node-and-ssh-error-no-display-environment-variable-specified/100327
**Category:** General
**Tags:** docker
**Created:** [6 February 2026 16:10 UTC](https://discourse.nodered.org/t/trying-to-run-firefox-on-pi-with-exec-node-and-ssh-error-no-display-environment-variable-specified/100327 "2026-02-06T16:10:52Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Mastiff](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@Mastiff](https://discourse.nodered.org/u/Mastiff)
#### Post date: [6 February 2026 16:10 UTC](https://discourse.nodered.org/t/trying-to-run-firefox-on-pi-with-exec-node-and-ssh-error-no-display-environment-variable-specified/100327/1 "2026-02-06T16:10:52Z")

</div>

I'm sure this is very simple for those who knows how it's done, but I don't... I have a command line that is supposed to start Firefox to NRK streaming, the Norwegian counterpart to BBC, with an SSH message from the Docker container Node-RED runs in on the same Pi. This is the command I use:

`sshpass -p SECRET_PASSWORD ssh pi@192.168.10.103 -o StrictHostKeyChecking=no /usr/bin/firefox --private-window https://tv.nrk.no/serie/mesternes-mester/sesong/17/episode/KMTE60000726`

The page probably doesn't work outside of Norway for copyright reasons. But this gives me the error in the topic, `Error: no DISPLAY environment variable specified`

I think I understand why, it's because the command isn't sent to the GUI session that I have open on the Pi. But how should I do this to make it work?

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [6 February 2026 16:43 UTC](https://discourse.nodered.org/t/trying-to-run-firefox-on-pi-with-exec-node-and-ssh-error-no-display-environment-variable-specified/100327/2 "2026-02-06T16:43:32Z")

</div>

> [@Mastiff](#):
>
> I think I understand why, it's because the command isn't sent to the GUI session that I have open on the Pi. But how should I do this to make it wor

You should be able to add the environment variable setting before the command. If you do an internet search, you should easily find the exact text - been a very long time since I did it so I can't quite remember the code.

This happens because, when you run Node-RED from systemd, it does not get (and indeed, _should_ not get) the standard user environment variables.

---

<div class="post-metadata">

### Author: ![Mastiff](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@Mastiff](https://discourse.nodered.org/u/Mastiff)
#### Post date: [6 February 2026 16:58 UTC](https://discourse.nodered.org/t/trying-to-run-firefox-on-pi-with-exec-node-and-ssh-error-no-display-environment-variable-specified/100327/3 "2026-02-06T16:58:14Z")

</div>

Thanks for answering! Especially when it's ran from a Docker container, as I do, which is it's own environment in itself. I tried to searh for environment variable, but the answers only confused me more, I'm afraid... I am running as the standard user pi, if that helps any.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [6 February 2026 17:08 UTC](https://discourse.nodered.org/t/trying-to-run-firefox-on-pi-with-exec-node-and-ssh-error-no-display-environment-variable-specified/100327/4 "2026-02-06T17:08:16Z")

</div>

> [@Mastiff](#):
>
> Docker container

Ah, you probably should have led with that. 😉 I've updated the tags on this thread accordingly.

> [@Mastiff](#):
>
> I am running as the standard user pi, if that helps any.

Not really 😃.

I'm not much good with Docker - but I'm fairly good at internet searches. 🧙‍♂️ So try this:

> **[How to expose the linux desktop environment to a bash command run inside a...](https://search.brave.com/search?q=how+to+expose+the+Linux+desktop+environment+to+a+bash+command+run+inside+a+docker+container%3F&summary=1&conversation=08b43b300964f6380ab2936c7ddd01862758)**
>
> To expose the Linux desktop environment to a bash command inside a Docker container, you need to configure the container to access the host's X11 display server and set the appropriate environment variables. Here’s how:
> 
> X11 Forwarding Setup:
> \- Run...

---

<div class="post-metadata">

### Author: ![Mastiff](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@Mastiff](https://discourse.nodered.org/u/Mastiff)
#### Post date: [6 February 2026 17:13 UTC](https://discourse.nodered.org/t/trying-to-run-firefox-on-pi-with-exec-node-and-ssh-error-no-display-environment-variable-specified/100327/5 "2026-02-06T17:13:26Z")

</div>

Actually I did lead with that, in the first message. 😀 But if I understand what you have found correctly it is not the same. I do not want to expose the desktop to the container, I only want to be able to send the command with SSH to the host.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [6 February 2026 20:01 UTC](https://discourse.nodered.org/t/trying-to-run-firefox-on-pi-with-exec-node-and-ssh-error-no-display-environment-variable-specified/100327/6 "2026-02-06T20:01:50Z")

</div>

> [@Mastiff](#):
>
> I only want to be able to send the command with SSH to the host

My bad.

You've not chosen an easy approach and I'd question whether you are getting any benefit at all from using Docker for Node-RED? But if you really have to do it that way, first you will have to have a method for safely accessing the host from the container - I have to assume that you've done that?

Then the command you run on the host has to be prefixed with setting the display environment variable.

> **[On linux, how to set the display env for a bash command?](https://search.brave.com/search?q=on+linux%2C+how+to+set+the+display+env+for+a+bash+command%3F&source=web&summary=1&conversation=08b4876367ae5da1996fb72cc09bbf4e4991)**
>
> To set the \`DISPLAY\` environment variable for a single bash command, use the syntax:
> 
> \`\`\`bash
> DISPLAY=:1 yourcommand
> \`\`\`
> 
> For example:
> \`\`\`bash
> DISPLAY=:1 xclock
> \`\`\`
> 
> This sets the \`DISPLAY\` variable only for the duration of that command, without...

---

<div class="post-metadata">

### Author: ![Mastiff](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@Mastiff](https://discourse.nodered.org/u/Mastiff)
#### Post date: [7 February 2026 11:31 UTC](https://discourse.nodered.org/t/trying-to-run-firefox-on-pi-with-exec-node-and-ssh-error-no-display-environment-variable-specified/100327/7 "2026-02-07T11:31:03Z")

</div>

Finally found it. And it was so simple that it's embarassing... `DISPLAY=:0` before `firefox` was all that was needed! 🤦 Thanks for the input, @TotallyInformation!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [21 February 2026 11:31 UTC](https://discourse.nodered.org/t/trying-to-run-firefox-on-pi-with-exec-node-and-ssh-error-no-display-environment-variable-specified/100327/8 "2026-02-21T11:31:08Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
