> For the complete documentation index, see [llms.txt](https://kaze.gitbook.io/qa-theory/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kaze.gitbook.io/qa-theory/ci/kak-zapustit-konteiner.md).

# Как запустить контейнер?

Запуск контейнера в Docker выполняется командой `docker run`, которая создаёт и запускает контейнер из образа.

***

#### **Базовая команда**

```bash
docker run <image_name>
```

* `<image_name>` — имя образа, например `myapp:latest`.

***

#### **Часто используемые опции**

1. **-d** — запуск в фоне (detached mode):

```bash
docker run -d myapp:latest
```

2. **--name** — задать имя контейнера:

```bash
docker run -d --name my_container myapp:latest
```

3. **-p** — проброс портов между хостом и контейнером:

```bash
docker run -d -p 8080:80 myapp:latest
```

* Сервис внутри контейнера слушает порт 80, а снаружи доступен на 8080.

4. **-v** — подключение томов (volumes) для хранения данных:

```bash
docker run -d -v /host/path:/container/path myapp:latest
```

5. **-it** — интерактивный режим с терминалом (для командной работы внутри контейнера):

```bash
docker run -it myapp:latest /bin/bash
```

***

#### **Просмотр запущенных контейнеров**

```bash
docker ps
```

#### **Остановка контейнера**

```bash
docker stop my_container
```

#### **Удаление контейнера**

```bash
docker rm my_container
```

***

Итог: **`docker run` создаёт и запускает контейнер из образа**, а опции позволяют настроить порты, тома, режим работы и имя контейнера.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kaze.gitbook.io/qa-theory/ci/kak-zapustit-konteiner.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
