---
title: "Your first VM"
description: "A whole Linux machine, a web server and a public URL in about a minute. Then make it vanish."
canonical_url: "https://docs.ghostdock.ai/getting-started/first-vm"
---
# Your first VM

> A whole Linux machine, a web server and a public URL in about a minute. Then make it vanish.

A Ghostdock VM is a whole Linux machine, ready in seconds: Docker, SSH and systemd, and a URL for
any port you choose. It sleeps when it is idle and wakes up when it is needed.

On this page you create one, run a web server in it, put it on a public URL, and make it vanish
again. About a minute, start to finish. You need a [connected agent or the
CLI](https://docs.ghostdock.ai/getting-started/connect).

## With your agent

Paste this into an agent that has Ghostdock connected:

```text [Prompt]
Create a Ghostdock VM called hello. Run nginx in it on port 8080, give port 8080 a public URL
that wakes the VM, and send me the URL.
```

That's the whole job. The agent reads Ghostdock's `vm` skill and calls the tools on its own:
`vm_up`, a command in the VM, then `vm_url_set`.

## With the CLI

**1. Create the VM.**

```bash [Terminal]
ghostdock vm up --name hello
```

It shows each step while the VM starts, then the VM's details. Leave out `--name` and Ghostdock
picks a name like `quiet-harbor`. `ghostdock vm list` now shows `⚓ hello  running`.

**2. Run a web server in it.**

```bash [Terminal]
ghostdock vm ssh hello -- docker run -d --restart unless-stopped -p 8080:80 nginx
```

`vm ssh` logs you in to the VM. With `--` it runs one command and returns. Without it you get a
shell.

**3. Give it a URL.**

```bash [Terminal]
ghostdock vm url set hello 8080 --access public --wake
```

The URL is the `url.url` line of what it prints. Open it: you see nginx's welcome page.

- `--access public` lets anyone open it. Leave it out and only members of your organization can,
after signing in.
- `--wake` starts the VM when someone opens the URL while it is stopped. A VM stops by itself when
it is idle, and starts again where it left off.

**4. Make it vanish.**

```bash [Terminal]
ghostdock vm delete hello
```

The VM and its files are gone for good. The next one is a command away.

## What you can do next

- See every VM in the app: [ghostdock.ai](https://ghostdock.ai).
- Run your own code: `ghostdock vm up --compose ./compose.yaml`, `--dockerfile ./Dockerfile` or
`--image <image>`.
- Copy files in and out: `ghostdock vm cp hello ./dist :/srv/app`.
- Read how VMs work, for people and agents: `ghostdock skill get vm`.


## Sitemap

See the full [sitemap](https://docs.ghostdock.ai/sitemap.md) for all pages.
