Skip to content

User-namespace isolation

Why every Legion host must run Docker with user namespaces, how the installer and the agent turn it on for you, what each state on the host page means, and the manual command.

On this page

What it is

User-namespace isolation is Docker's userns-remap setting. With it on, root inside a rental's container is an unprivileged user ID on your machine, not root. A renter who is root in their container still can't act as root on your host.

Why it is required

Renters run their own images, as root, on your machine. Remapping root to an unprivileged ID means a mistake or an escape inside a container lands with no special rights on your host. Legion requires it on every host so that renting out a machine stays safe for the provider and for the other people whose rentals share it.

From when

From Nov 25, 2026 at 15:00 UTC, a host that has not verified isolation is not offered for rent:

  • It gets no new rentals and no new service replicas.

  • Rentals already running on it continue.

  • A renter can still start a stopped rental of their own that is on it.

The host's page says Not offered for rent now once this applies. It is offered again at the agent's next sync after the check passes.

It turns on by itself

You don't need to run anything in most cases:

  • The installer turns it on when Docker is not remapped and the host has no rentals. With no other containers or volumes on Docker it does so with no prompt. With some, an interactive install asks once, with the default yes. A non-interactive install leaves Docker alone and says why.

  • The agent turns it on by itself when the host has no rentals and no containers or volumes that are not Legion's. It checks at every start, together with the driver, the NVIDIA runtime, runc and the disk. First it holds the host: no new rental or service replica is placed on it. After two syncs in a row with nothing running, it restarts Docker once, proves in a test container that root is remapped and the GPUs work, and starts again. The whole switch takes a few minutes.

  • If a switch fails, the agent puts Docker back as it was, the host keeps working as before, and the agent tries again after 6 hours, or after an agent upgrade.

Docker downloads images again the first time each one is used after the switch, because images are stored per mapping.

Check a host

In the app, open the host's page. The Isolation section says where it stands, and the Hosts list marks a host that is off with Isolation off:

Check a host
StateWhat the page saysWhat to do
OnIsolation: onNothing.
Waiting for rentals to endIsolation off: the agent turns it on by itself when this host has no rentals.Nothing. It starts when the rentals end.
SwitchingTurning isolation on: Docker restarts once, and new rentals wait until it is done (a few minutes).Wait.
Other containersIsolation off: your host runs other containers; run sudo legion-agent enable-userns when they're stoppedThe agent never touches Docker while it has containers or volumes that are not Legion's. Stop them, then run the command, or let the agent do it once Docker is idle.
FailedIsolation off: turning it on failed, with the reason. Docker was put back as it was. The agent tries again after the time shown, or run sudo legion-agent enable-userns.Fix the reason, or run the command.
GPU check failsIsolation off: Docker runs with user namespaces, but the GPU check under them fails.The host is not rentable from the date above. Check the NVIDIA runtime.
Can't switchIsolation off, with the reason: rootless Docker is not supported, daemon.json names another remap user, dockerd flags override daemon.json, or daemon.json cannot be read.Fix that setting; the agent picks it up.
Older agentIsolation off. Update the agent: from 0.11 it turns isolation on by itself when the host is idle. Or run sudo legion-agent enable-userns.Update the agent.

On the machine, sudo legion-agent status prints the state and the next step:

Shell
sudo legion-agent status
Shell
docker info --format '{{ json .SecurityOptions }}'

The second command lists name=userns when Docker runs with user namespaces.

New hosts

The install command turns it on for you, as described above. The option --no-userns-remap leaves Docker alone; the agent still turns it on by itself once the host is idle, and until then a host without it is not rented from the date above. See Install the agent.

Turn it on yourself

Use the command when the host page says other containers, when a switch failed and you don't want to wait, or when the agent is too old to do it. Do this while the host has no rentals.

  1. On the host's page, open Manage and press Stop new rentals, so no new rental starts while you work. Wait until no rentals are running on it.

  2. On the machine, run:

Shell
sudo legion-agent enable-userns

If the host was enrolled without GPUs, add --no-gpu:

Shell
sudo legion-agent enable-userns --no-gpu

Use --no-gpu only for such a host. On a host with GPUs, leave it out: the command proves the GPUs work.

  1. When the host page says Isolation: on, list the host again from its Listing tab.

What happens

  • Docker restarts once.

  • Docker downloads images again the first time each one is used, because images are stored per mapping.

  • A test container proves root is remapped and the GPUs work.

  • If any check fails, Docker is put back as it was and the reason is shown. The host keeps working as before and stays marked Isolation off.

The command refuses while rentals or containers are on the host. Forcing it anyway would leave those rentals unable to read or write the files they already have, so unlist the host and wait for them to end first.

Turn it off

You can't turn it off and stay rentable: from the date above a host without it is not offered. To take a host out of the market instead, press Stop new rentals, or remove it.

To turn it off on the machine, with no rentals on the host, remove "userns-remap" from /etc/docker/daemon.json, then run sudo systemctl restart docker and sudo systemctl restart legion-agent. The agent turns it on again once the host is idle.

Notifications

When one of your hosts has not turned isolation on, Legion tells you in the app and by email. Notifications are listed under Host isolation off in your notification settings.