Why doesn't the editor work when I get out of the terminal

So, maybe a little context around how executables run under Linux would help make this clearer because process execution can be very confusing.

When a program is run under Linux, this is called a process. You can think of it like a machine that someone does something to get it to perform a function. These processes (like the machine) need a user (or another process which was initially started by a user) to start them.

When a user is logged into the system interactively (usually via a GUI, command line, or SSH), the process will generally continue to run until one of four things happens:

  1. The process finishes what it was supposed to do
  2. The process experiences an error and crashes
  3. The user kills the process
  4. The session closes either by the user or the system

At this point, the process is no longer running and what it was doing has stopped. So, in the case of n8n, when the docker process is no longer running because the session has closed, n8n is no longer available.

Earlier, I mentioned that the process will generally run until one of four things happens. There is an exception to this and it occurs when an application is run in the background or detached from a user session. This way, when the session is closed, the application will still be available, assuming that it either has a different way of interacting with a user (i.e. the n8n web interface) or does not require user interaction (e.g. an automated backup program). These type of processes are sometimes referred to as services or daemons.

There are several ways to keep these processes running in the background after you have closed the terminal. You may wish to give this article a read or my earlier post about running n8n as a service using PM2.

Hopefully that helps with a bit of understanding what is going on behind the scenes.

3 Likes