# Run containers with the local container runtime

> For the complete documentation index, see [llms.txt](https://docs.ringleader.dev/llms.txt).


> Create the local container runtime, choose the folders it shares, and delete it, so you can run containers without Docker Desktop.


Create the local container runtime, choose the folders it shares, and delete it, so you can
run containers without Docker Desktop. Creating the runtime switches your `docker` command to
it. The runtime is a Linux virtual machine that Ringleader runs on your computer.

## Prerequisites

- [Ringleader installed](https://docs.ringleader.dev/install/) on a Mac or a Windows PC.
- The examples use the runtime's own name, `local-runtime`, and a project folder at
  `~/code/myproject`. Replace the folder with yours.
- [Local container runtime](https://docs.ringleader.dev/reference/local-container-runtime/) explains the
  runtime and what it shares, if you want to read it first.

## Create the local runtime


### Use the application


1. Open **Settings**, then the **Local runtime** tab.
2. Click **Create Local Container Workstation**. Ringleader creates the runtime, switches
   `docker` to it, and waits until Docker in the runtime answers.



### Use the command line


Run this command. Ringleader creates the runtime, switches `docker` to it, and waits until
Docker in the runtime answers.

```bash
rl local-runtime create
```

[`rl local-runtime`](https://docs.ringleader.dev/reference/cli/commands/local-runtime/) lists every form of the command and
its flags. `rl --help` doesn't list the command, because the application drives it.






## Check that the runtime works

To check that it works, start a container that publishes a port, and reach it from your
computer:

1. Start the container:

   ```bash
   docker run -d -p 8888:80 nginx
   ```

2. Reach the container from your computer:

   ```bash
   curl localhost:8888
   ```

## Choose the folders the runtime shares

On a runtime on vz, you can share fewer folders than the four standard volumes. A share flag is
refused on a runtime that doesn't run on vz.

Changing the folders restarts the runtime, which stops its running containers. The runtime
records your choice, so running `rl local-runtime create` again, or **Re-apply Local Container
Workstation** in the application, keeps it. `create` refuses a folder that doesn't exist on your Mac, and changes
nothing.


### Use the application


1. In **Settings**, open the **Local runtime** tab and find its **Shared folders** section. It lists the folders on your Mac that `docker run -v` can give a container.
2. Use the switch of each of the four standard volumes to turn it on or off. Click **Add folder** to pick another folder, or **Remove** next to one you added.
3. Click **Apply**. It first says that the runtime restarts and its running containers stop, and then applies your changes. Before the runtime exists, the button at the top creates it with the folders you chose.

The section makes the same change as `rl local-runtime create` with its share flags, as [Local runtime](https://docs.ringleader.dev/reference/desktop-application/#local-runtime) describes.



### Use the command line


To share only `$TMPDIR` and one project folder, run:

```bash
rl local-runtime create --standard-volumes private-var-folders --volume ~/code/myproject
```

`--volume`, or `-v`, takes a folder in the shape `docker run -v` uses:

- `~/code/app` shares the folder at the same path in the runtime.
- `~/code/app:/src` shares it at `/src` in the runtime.
- `~/code/app:ro` or `~/code/app:/src:ro` shares it read-only. A folder is writable unless its
  value ends in `:ro`.

To change one folder at a time, use `rl local-runtime volume`:

```bash
rl local-runtime volume add ~/code/other:ro
rl local-runtime volume remove /Volumes     # turns the volumes standard volume off
rl local-runtime volume list
```






## Get files into a container on Windows

On Windows, a container can't mount a folder by its Windows path, so get files into a container
in one of these ways instead:

- Keep files the container owns in a named volume.
- Copy files into or out of a container with `docker cp`.
- Copy a folder into the runtime with
  `rl file cp -r ./project local-runtime:/home/dev/workspace/project`, then mount that runtime
  path in a container.

## Delete the local runtime

<div class="callout callout-warning">
  <p class="callout-title">Containers, images and volumes are deleted</p>
  <div class="callout-body">
    Deleting the runtime removes the containers, images and volumes in it, and switches <code>docker</code>
back to the Docker context you had before.
  </div>
</div>



### Use the application


Click **Delete** on the runtime's card on the **Local runtime** tab.



### Use the command line


Run:

```bash
rl local-runtime delete
```






## Next steps

- [Local container runtime](https://docs.ringleader.dev/reference/local-container-runtime/) explains the
  runtime, the folders it shares and the limits your organization can set on them.
- [Repair Docker after removing Docker Desktop](https://docs.ringleader.dev/guides/repair-docker-after-removing-docker-desktop/)
  fixes `docker` when Docker Desktop's removal left its settings behind.
- [`rl local-runtime`](https://docs.ringleader.dev/reference/cli/commands/local-runtime/) lists every form of the command
  and its flags.

