# Quick start (/en/docs/quick-start)

Run ImgYoung with Docker, sign in to the console, upload your first image and get its Markdown link.

You need a machine with Docker installed (Linux, macOS or Windows) whose port 8721 you can reach from a browser. For installs without Docker, see [Install](./install/index.mdx).

<Steps>
<Step>

### Start the service [#start-the-service]

```bash title="Terminal"
docker run -d --name imgyoung --restart unless-stopped \
  -p 8721:8721 \
  -v imgyoung-data:/data \
  ghcr.io/x-haose/imgyoung:latest
```

- `-v imgyoung-data:/data`: the database, the images in the built-in local channel and the master key `master.key` all live in this volume. Deleting the volume deletes everything.
- `--restart unless-stopped`: restoring the metadata database from a snapshot in the console makes the service exit on purpose; Docker starts it again and the snapshot is swapped in on startup. Without a restart policy the container stays stopped after a restore.

Check that it started:

```bash title="Terminal"
docker logs imgyoung
```

Look for a line with `msg="ImgYoung 已启动"` (log messages are in Chinese). The first start also prints two `level=WARN` lines, `已生成主密钥文件,请立即备份——丢失将导致渠道配置与加密渠道数据永久不可恢复` (a master key file was generated; back it up now) and `已初始化默认管理员密码,请登录后立即在后台修改` (the default admin password was initialized; change it after signing in). Both are expected.

</Step>
<Step>

### Sign in and change the password [#sign-in-and-change-the-password]

Open `http://<server address>:8721/` in a browser (`http://localhost:8721/` on the same machine) and sign in with the factory account:

| Username | Password |
|---|---|
| `admin` | `imgyoung123` |

The factory password is public. After the first sign-in you land on the "Set the admin password" page. Until the password is changed no other console page opens, and the server rejects every console API call other than signing out, reading your own account and changing the password (with 403). The new password needs at least 8 characters; click "Save and sign in again", then sign in with the new password.

</Step>
<Step>

### Upload your first image [#upload-your-first-image]

Pick one: upload in the console, or issue an upload token and upload with curl.

<Tabs items={['Console', 'curl']}>
<Tab value="Console">

1. Open "Images" in the sidebar and click "Upload".
2. Drag images into the dialog, or press Ctrl / ⌘ + V to paste a screenshot from the clipboard. JPEG, PNG, GIF and WebP are accepted, up to 50 MB per image by default.
3. When the upload finishes, close the dialog, click the image card to open "Image details", and under "Share link" pick **Markdown** next to "Copy as".

</Tab>
<Tab value="curl">

1. Open "Upload tokens" in the sidebar, click "Issue token", enter `curl` as the purpose, leave the expiry at "Never", and click "Issue".
2. Copy the token shown in the dialog; it starts with `imgy_`. It is shown only this once, and the dialog only closes after you tick "I have stored this secret safely".
3. Upload:

```bash title="Terminal"
curl -H "Authorization: Bearer imgy_your_token" \
  -F "file=@screenshot.png" \
  http://localhost:8721/api/upload
```

```json title="Response"
{"id":"R0RjUyP1UW","url":"http://localhost:8721/i/R0RjUyP1UW"}
```

`url` is the image address. With jq installed you can get the Markdown directly:

```bash title="Terminal"
curl -s -H "Authorization: Bearer imgy_your_token" -F "file=@screenshot.png" \
  http://localhost:8721/api/upload | jq -r '"![](\(.url))"'
```

</Tab>
</Tabs>

The Markdown looks like this:

```md
![](http://localhost:8721/i/R0RjUyP1UW)
```

Paste it into your blog or notes and the image shows up.

</Step>
</Steps>

<Callout type="info" title="Where the host name in the link comes from">
  Until the public site address (`base_url`) is configured, links are built from the address of the current request: if you opened the console via `localhost`, the copied link points to `localhost` and will not work on other machines.
  To share links, open the console through its public domain or IP, or set `base_url` under "Settings → Runtime settings". See [Configuration](./configuration.mdx).
</Callout>

## Next steps [#next-steps]

<Callout type="warn" title="Right now everything sits on one disk">
  A fresh instance has only the built-in `local` channel, which stores images under `blobs/` in the data volume. Metadata snapshots are written to every healthy channel, so for now this disk holds the only copy. If it fails, the images and the snapshots are lost together, and the "Dashboard" warns "Your data only lives on this host".
  Open "Storage channels" in the sidebar soon and click "New channel" to add an off-site object storage or cloud drive channel. Existing images are replicated to it automatically, and a snapshot is written there on the next scheduled backup or the next start; for a copy right away, click "Back up now" under "Settings → Backups & export". Once the new channel is healthy, the dashboard warning goes away.
</Callout>

- [Storage channels](./channels/index.mdx): add an off-site channel, set priority and encryption.
- [Backup and restore](./operations/backup.mdx): back up the master key `master.key` separately. It is not part of the snapshots; without it the service refuses to start, and the channel credentials and encrypted data cannot be recovered.
- [Reverse proxy](./operations/reverse-proxy.mdx): serve it over HTTPS on your own domain.
- [Clients](./guides/clients.mdx): set up PicGo, PicList, Typora and other clients.
- [Docker image](./install/docker.mdx): image tags, the data volume and environment variables in full.
