> For the complete documentation index, see [llms.txt](https://docs.edgegap.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.edgegap.com/ru/docs/tools-and-integrations/container/ssh.md).

# SSH в вашем контейнере

{% hint style="warning" %}
Edgegap не рекомендует делать службу SSH доступной в ваших продуктивных развертываниях.
{% endhint %}

### Изменение вашего Dockerfile

Мы будем собирать контейнер Docker, используя другой Docker `Dockerfile` в этой версии.

Нам нужно установить службу OpenSSH и включить её. Создайте пользователя и пароль для подключения к вашему серверу.

В контейнере, запущенном на **Alpine**, объедините следующее:

```dockerfile
RUN apk --update add --no-cache openssh bash
RUN sed -i s/#PermitRootLogin.*/PermitRootLogin\ yes/ /etc/ssh/sshd_config
RUN echo "tester:$ecureP@ss" | chpasswd

EXPOSE 22
```

В контейнере, запущенном на **Ubuntu**, добавьте следующее:

```dockerfile
RUN apt-get update
RUN apt-get install openssh-server sudo -y

RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1000
RUN echo 'tester:$ecureP@ss' | chpasswd

EXPOSE 22
```

В вашем entrypoint вам нужно будет добавить следующую команду:

```sh
service ssh start
```

Мы рекомендуем протестировать развертывание локально, используя команду docker run, чтобы проверить запуск сервера.

После тестирования вы можете запушить вашу новую версию в репозиторий контейнеров.

### На Edgegap

Мы предлагаем иметь версию с именем `-dev` или что-то, что имеет смысл для вашего сервиса. Таким образом у вас будет возможность выполнить некоторые тесты и легко войти в ваш контейнер с использованием инфраструктуры Edgegap.

1. Создайте новую версию вашего приложения, добавив `Открыть TCP-порт 22`
2. Создайте развертывание, используя только что созданную версию
3. Как только служба запущена (Ready), посмотрите информацию о вашем развертывании. Вы увидите внешнее отображение порта 22.
4. Вы можете использовать Putty и подключиться, используя FQDN развертывания или IP и отображаемый порт
5. Имя пользователя и пароль, которые вы настроили.


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.edgegap.com/ru/docs/tools-and-integrations/container/ssh.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
