Skip to content

Commit 218d574

Browse files
Update configure-custom-container.md
1 parent 4c91b26 commit 218d574

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

articles/app-service/configure-custom-container.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ Group Managed Service Accounts (gMSAs) are currently not supported in Windows co
366366
Secure Shell (SSH) is commonly used to execute administrative commands remotely from a command-line terminal. In order to enable the Azure Portal SSH console feature with custom containers, the following steps are required:
367367

368368
1. Create a standard [sshd_config](https://man.openbsd.org/sshd_config) file with the following example contents and place it on the application project root directory:
369-
369+
370370
```
371371
Port 2222
372372
ListenAddress 0.0.0.0
@@ -381,24 +381,24 @@ Secure Shell (SSH) is commonly used to execute administrative commands remotely
381381
PermitRootLogin yes
382382
Subsystem sftp internal-sftp
383383
```
384-
384+
385385
> [!NOTE]
386386
> This file configures OpenSSH and must include the following items in order to comply with the Azure Portal SSH feature:
387387
> - `Port` must be set to 2222.
388388
> - `Ciphers` must include at least one item in this list: `aes128-cbc,3des-cbc,aes256-cbc`.
389389
> - `MACs` must include at least one item in this list: `hmac-sha1,hmac-sha1-96`.
390-
390+
391391
2. Create an entrypoint script with the name `entrypoint.sh` (or change any existing entrypoint file) and add the command to start the SSH service, along with the application startup command. The below example demonstrates starting a Python application, please replace the last command according to the project language/stack:
392-
392+
393393
### [Debian](#tab/debian)
394-
394+
395395
```Bash
396396
#!/bin/sh
397397
set -e
398398
service ssh start
399399
exec gunicorn -w 4 -b 0.0.0.0:8000 app:app
400400
```
401-
401+
402402
### [Alpine](#tab/alpine)
403403
404404
```Bash
@@ -408,46 +408,46 @@ Secure Shell (SSH) is commonly used to execute administrative commands remotely
408408
exec gunicorn -w 4 -b 0.0.0.0:8000 app:app
409409
```
410410
---
411-
411+
412412
3. Add to the Dockerfile the following instructions according to the base image distribution. The same will copy the new files, install OpenSSH server, set proper permissions and configure the custom entrypoint, and expose the ports required by the application and SSH server, respectively:
413-
413+
414414
### [Debian](#tab/debian)
415-
415+
416416
```Dockerfile
417-
COPY sshd_config /etc/ssh/
418417
COPY entrypoint.sh ./
419-
418+
420419
# Start and enable SSH
421420
RUN apt-get update \
422421
&& apt-get install -y --no-install-recommends dialog \
423422
&& apt-get install -y --no-install-recommends openssh-server \
424423
&& echo "root:Docker!" | chpasswd \
425424
&& chmod u+x ./entrypoint.sh
426-
425+
COPY sshd_config /etc/ssh/
426+
427427
EXPOSE 8000 2222
428-
428+
429429
ENTRYPOINT [ "./entrypoint.sh" ]
430430
```
431-
431+
432432
### [Alpine](#tab/alpine)
433-
433+
434434
```Dockerfile
435435
COPY sshd_config /etc/ssh/
436436
COPY entrypoint.sh ./
437-
437+
438438
# Start and enable SSH
439439
RUN apk add openssh \
440440
&& echo "root:Docker!" | chpasswd \
441441
&& chmod +x ./entrypoint.sh \
442442
&& cd /etc/ssh/ \
443443
&& ssh-keygen -A
444-
444+
445445
EXPOSE 8000 2222
446-
446+
447447
ENTRYPOINT [ "./entrypoint.sh" ]
448448
```
449449
---
450-
450+
451451
> [!NOTE]
452452
> The root password must be exactly `Docker!` as it is used by App Service to let you access the SSH session with the container. This configuration doesn't allow external connections to the container. Port 2222 of the container is accessible only within the bridge network of a private virtual network and is not accessible to an attacker on the internet.
453453

0 commit comments

Comments
 (0)