MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.3k stars 21.47k forks source link

SSH instructions for webapps using docker container are incorrect #26454

Closed i3anaan closed 5 years ago

i3anaan commented 5 years ago

The instructions on how to connect to SSH on a Linux Web App running a docker instance claim you can enable (web) ssh support with some extra dockerfile instructions, this however does not work.

Seeing that the actual command being run does not actually expose port 2222, connecting with web ssh is doomed to fail, no matter what instructions you add to the image build process.

2019-03-07 10:28:38.337 INFO  - docker run -d -p 48442:80 --name <redacted> -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITE_SITE_NAME=<redacted> -e WEBSITE_AUTH_ENABLED=False -e PORT=80 -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_INSTANCE_ID=<redacted>  

gained from the Logs in the AppService->Container settings menu on portal.azure.com, some private details are ommitted

Details on the EXPOSE dockerfile instructions not actually opening a port can be found at the official docker documentation. Specifically this section:

The EXPOSE instruction does not actually publish the port. It functions as a type of documentation between the person who builds the image and the person who runs the container, about which ports are intended to be published. To actually publish the port when running the container, use the -p flag on docker run to publish and map one or more ports, or the -P flag to publish all exposed ports and map them to high-order ports.

Please fix the issue (should be an easy fix), or if not mark the broken functionality in the documentation.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

CHEEKATLAPRADEEP-MSFT-zz commented 5 years ago

@i3anaan Thanks for your feedback! We will investigate and update as appropriate.

BryanTrach-MSFT commented 5 years ago

@i3anaan I also had issues with the steps provided. I have reassigned your feedback to the doc author to have them determine if this is a regression in the docs or the product.

@msangapu Please let me know if this appears to be a regression in the product.

i3anaan commented 5 years ago

@BryanTrach-MSFT @msangapu Thank you for responding quickly, any update or a timeline on this?

mattyweb commented 5 years ago

also, it looks like the link for the example repository doesn't work: https://github.com/Azure-App-Service/node/blob/master/6.9.3/

i've searched for it on GitHub but came up empty...

patricklee2 commented 5 years ago

port 2222 is not exposed the the public internet, We connect via a kudu container via port 2222, on the same bridge network. Webssh run on the kudu container

Include port 2222 in the EXPOSE instruction for the Dockerfile. Although the root password is known, port 2222 cannot be accessed from the internet. It is an internal only port accessible only by containers within the bridge network of a private virtual network.

mattyweb commented 5 years ago

Hi Patrick,

Thanks for getting back to me.

I added a new file called AzureDockerfile which I'm now using in the DayAxe Web Docker Build. It now has the EXPOSE 2222 command in it.

However, I'm still getting the same result. The build and release steps all look fine (everything is green), but browsing the site ( https://dayaxe-web-stage.azurewebsites.net/) brings up an error. And the application logs still have the same message:

2019-03-21 22:10:17.480 INFO - Issuing docker pull: imagename =dayaxe/dayaxe-web:20 2019-03-21 22:10:17.830 INFO - Issuing docker pull: imagename =dayaxe/dayaxe-web:20 2019-03-21 22:10:18.342 INFO - Issuing docker pull dayaxe/dayaxe-web:20 2019-03-21 22:10:19.303 ERROR - docker pull returned STDERR>> Error response from daemon: pull access denied for dayaxe/dayaxe-web, repository does not exist or may require 'docker login'

Please note that thing work fine if the Docker Hub repos are set to public (but obviously we don't want to have our stuff in the wild...).

AzureDockerfile Contents

using the official LTS node image. might try slimmer version at some

point. FROM node:10.15

set working directory and copy over files

WORKDIR /usr/src/app COPY . .

setting environment variables up for Azure staging environment (will use

production for all Azure sites) ENV NODE_ENV=production ENV PORT=443 ENV OPENWEATHER_APIKEY=ccf112262d9e4f0ba12c3cb05a8ba71b ENV ACCUWEATHER_APIKEY=d41dfd5e8a1748d0970cba6637647d96 ENV API_URL=https://dayaxe-web-stage.azurewebsites.net/api/v1/ ENV API_DOMAIN=https://dayaxe-web-stage.azurewebsites.net/ ENV CDN_URL=https://cdn.dayaxe.com

expose some ports for access from web and azure kudu (SCM) container

EXPOSE 443 EXPOSE 2222

install and start the project

RUN npm i -g yarn RUN yarn install --prod RUN yarn build

CMD [ "yarn", "start" ]

On Thu, Mar 21, 2019 at 1:59 PM Patrick notifications@github.com wrote:

port 2222 is not exposed the the public internet, We connect via a kudu container via port 2222, on the same bridge network. Webssh run on the kudu container

Include port 2222 in the EXPOSE instruction for the Dockerfile. Although the root password is known, port 2222 cannot be accessed from the internet. It is an internal only port accessible only by containers within the bridge network of a private virtual network.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475399980, or mute the thread https://github.com/notifications/unsubscribe-auth/AJui8DqOnqDCLl19DPTua43aIzqhcFi2ks5vY_KjgaJpZM4bi5hl .

patricklee2 commented 5 years ago

This that the complete docker file? You are missing the following

  1. install openssh-server
  2. copy a sshd_config
  3. start the ssh service See https://docs.microsoft.com/en-us/azure/app-service/containers/app-service-linux-ssh-support#use-ssh-support-with-custom-docker-images https://github.com/Azure-App-Service/node/tree/master/6.9
patricklee2 commented 5 years ago

alternatively you can use our blessed image as a base image FROM appsvc/node:10.14_1903081107

mattyweb commented 5 years ago

Got it. Will try the MS image first and revert to the OpenSSH approach if that works.

On Thu, Mar 21, 2019 at 3:55 PM Patrick notifications@github.com wrote:

alternatively you can use our blessed image as a base image FROM appsvc/node:10.14_1903081107

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475433465, or mute the thread https://github.com/notifications/unsubscribe-auth/AJui8Pq_u7JH6OHEq_KGzxaizNJmfwh5ks5vZA3tgaJpZM4bi5hl .

mattyweb commented 5 years ago

Still not working. Same error.

2019-03-21 23:14:22.419 INFO - Issuing docker pull: imagename =dayaxe/dayaxe-web:21 2019-03-21 23:14:22.922 INFO - Issuing docker pull: imagename =dayaxe/dayaxe-web:21 2019-03-21 23:14:23.415 INFO - Issuing docker pull dayaxe/dayaxe-web:21 2019-03-21 23:14:24.403 ERROR - docker pull returned STDERR>> Error response from daemon: pull access denied for dayaxe/dayaxe-web, repository does not exist or may require 'docker login'

Any ideas?

Dockerfile looks like this:

using the official LTS node image. might try slimmer version at some

point. FROM appsvc/node:10.14_1903081107

set working directory and copy over files

WORKDIR /usr/src/app COPY . .

setting environment variables up for Azure staging environment (will use

production for all Azure sites) ENV NODE_ENV=production ENV PORT=443 ENV OPENWEATHER_APIKEY=ccf112262d9e4f0ba12c3cb05a8ba71b ENV ACCUWEATHER_APIKEY=d41dfd5e8a1748d0970cba6637647d96 ENV API_URL=https://dayaxe-web-stage.azurewebsites.net/api/v1/ ENV API_DOMAIN=https://dayaxe-web-stage.azurewebsites.net/ ENV CDN_URL=https://cdn.dayaxe.com

expose some ports for access from web and azure kudu (SCM) container

EXPOSE 443 EXPOSE 2222

install and start the project

RUN npm i -g yarn RUN yarn install --prod RUN yarn build

CMD [ "yarn", "start" ]

On Thu, Mar 21, 2019 at 4:03 PM Matt Webster mattyweb@gmail.com wrote:

Got it. Will try the MS image first and revert to the OpenSSH approach if that works.

On Thu, Mar 21, 2019 at 3:55 PM Patrick notifications@github.com wrote:

alternatively you can use our blessed image as a base image FROM appsvc/node:10.14_1903081107

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475433465, or mute the thread https://github.com/notifications/unsubscribe-auth/AJui8Pq_u7JH6OHEq_KGzxaizNJmfwh5ks5vZA3tgaJpZM4bi5hl .

patricklee2 commented 5 years ago

CMD [ "yarn", "start" ], you still need to start the ssh service the blessed image uses init_container.sh as an entrypoint to accomplish this

mattyweb commented 5 years ago

Hi Patrick,

I'm still beating my head against the wall here. The builds and deploys look like they are working but I'm still getting the same error. I'm also still not able to use the webssh portal to connect to my image.

It's likely my script has something wrong with it. I'm not using PM2 so trying to extract the key bits from those examples. Also, I'm not super comfortable with bash scripts and would like to avoid doing too many of these.

My Dockerfile now looks like this:

using the official LTS node image. might try slimmer version at some

point. FROM node:10.15

set working directory and copy over files

WORKDIR /usr/src/app COPY . .

setting environment variables up for Azure staging environment (will use

production for all Azure sites) ENV NODE_ENV=production ENV PORT=443 ENV OPENWEATHER_APIKEY=ccf112262d9e4f0ba12c3cb05a8ba71b ENV ACCUWEATHER_APIKEY=d41dfd5e8a1748d0970cba6637647d96 ENV API_URL=https://dayaxe-web-stage.azurewebsites.net/api/v1/ ENV API_DOMAIN=https://dayaxe-web-stage.azurewebsites.net/ ENV CDN_URL=https://cdn.dayaxe.com

set up OpenSSL and ports for SSH

ENV SSH_PASSWD "root:Docker!" RUN apt-get update \ && apt-get install -y --no-install-recommends dialog \ && apt-get update \ && apt-get install -y --no-install-recommends openssh-server \ && echo "$SSH_PASSWD" | chpasswd

RUN rm -f /etc/ssh/sshd_config COPY sshd_config /etc/ssh/ ENV SSH_PORT 2222 RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config RUN service ssh start EXPOSE 2222

expose some ports for access from web and azure kudu (SCM) container

EXPOSE 443

install and start the project

RUN npm i -g yarn RUN yarn install --prod RUN yarn build

CMD [ "yarn", "start" ]

Here is the relevant part of the build log. Nothing is jumping out at me here, but I'm not sure what I should be looking for.

Step 11/33 : ENV SSH_PASSWD "root:Docker!" ---> Running in c89d35497a3c Removing intermediate container c89d35497a3c ---> 5e4452b269dc Step 12/33 : RUN apt-get update && apt-get install -y --no-install-recommends dialog && apt-get update && apt-get install -y --no-install-recommends openssh-server && echo "$SSH_PASSWD" | chpasswd ---> Running in 86a36cf4e04f Ign:1 http://deb.debian.org/debian stretch InRelease Get:2 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB] Get:3 http://deb.debian.org/debian stretch Release [118 kB] Get:4 http://deb.debian.org/debian stretch Release.gpg [2434 B] Get:5 http://deb.debian.org/debian stretch-updates/main amd64 Packages [11.1 kB] Get:6 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB] Get:7 http://deb.debian.org/debian stretch/main amd64 Packages [7084 kB] Get:8 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [480 kB] Fetched 7880 kB in 1s (5364 kB/s) Reading package lists... Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: dialog 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 262 kB of archives. After this operation, 1138 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian stretch/main amd64 dialog amd64 1.3-20160828-2 [262 kB] debconf: delaying package configuration, since apt-utils is not installedFetched 262 kB in 0s (8832 kB/s)‌ Selecting previously unselected package dialog. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 29978 files and directories currently installed.) Preparing to unpack .../dialog_1.3-20160828-2_amd64.deb ... Unpacking dialog (1.3-20160828-2) ... Setting up dialog (1.3-20160828-2) ... Hit:1 http://security.debian.org/debian-security stretch/updates InRelease Ign:2 http://deb.debian.org/debian stretch InRelease Hit:3 http://deb.debian.org/debian stretch-updates InRelease Hit:4 http://deb.debian.org/debian stretch Release Reading package lists... Reading package lists... Building dependency tree... Reading state information... The following additional packages will be installed: libwrap0 openssh-sftp-server Suggested packages: molly-guard monkeysphere rssh ssh-askpass ufw Recommended packages: tcpd libpam-systemd ncurses-term xauth The following NEW packages will be installed: libwrap0 openssh-server openssh-sftp-server 0 upgraded, 3 newly installed, 0 to remove and 2 not upgraded. Need to get 430 kB of archives. After this operation, 1119 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian stretch/main amd64 libwrap0 amd64 7.6.q-26 [58.2 kB] Get:2 http://security.debian.org/debian-security stretch/updates/main amd64 openssh-sftp-server amd64 1:7.4p1-10+deb9u6 [39.7 kB] Get:3 http://security.debian.org/debian-security stretch/updates/main amd64 openssh-server amd64 1:7.4p1-10+deb9u6 [332 kB] debconf: delaying package configuration, since apt-utils is not installedFetched 430 kB in 0s (19.0 MB/s)‌ Selecting previously unselected package libwrap0:amd64. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 30132 files and directories currently installed.) Preparing to unpack .../libwrap0_7.6.q-26_amd64.deb ... Unpacking libwrap0:amd64 (7.6.q-26) ... Selecting previously unselected package openssh-sftp-server. Preparing to unpack .../openssh-sftp-server_1%3a7.4p1-10+deb9u6_amd64.deb ... Unpacking openssh-sftp-server (1:7.4p1-10+deb9u6) ... Selecting previously unselected package openssh-server. Preparing to unpack .../openssh-server_1%3a7.4p1-10+deb9u6_amd64.deb ... Unpacking openssh-server (1:7.4p1-10+deb9u6) ... Setting up openssh-sftp-server (1:7.4p1-10+deb9u6) ... Processing triggers for libc-bin (2.24-11+deb9u4) ... Setting up libwrap0:amd64 (7.6.q-26) ... Setting up openssh-server (1:7.4p1-10+deb9u6) ... debconf: unable to initialize frontend: Dialog debconf: (TERM is not set, so the dialog frontend is not usable.) debconf: falling back to frontend: Readline

Creating config file /etc/ssh/sshd_config with new version Creating SSH2 RSA key; this may take some time ... 2048 SHA256:s5x/tFiaSyeij/e9mx6EKSClr5rd2cqu4FcxtGT9LP4 root@86a36cf4e04f (RSA) Creating SSH2 ECDSA key; this may take some time ... 256 SHA256:syiIWD5nialzaKzIW05C5b4ZWjaq97760W++tM0lzLQ root@86a36cf4e04f (ECDSA) Creating SSH2 ED25519 key; this may take some time ... 256 SHA256:CnIVQy7E87c5Cu1T5H+F3WtqeO/ciOeiBQoDnknEyfA root@86a36cf4e04f (ED25519) invoke-rc.d: could not determine current runlevel invoke-rc.d: policy-rc.d denied execution of start. Processing triggers for libc-bin (2.24-11+deb9u4) ... Removing intermediate container 86a36cf4e04f ---> e46d47d633d3 Step 13/33 : RUN rm -f /etc/ssh/sshd_config ---> Running in e2c346714a10 Removing intermediate container e2c346714a10 ---> 4fddc2236c33 Step 14/33 : COPY sshd_config /etc/ssh/ ---> c0f09eadf98f Step 15/33 : ENV SSH_PORT 2222 ---> Running in e3bb2a4dcd47 Removing intermediate container e3bb2a4dcd47 ---> b9b5bb428816 Step 16/33 : RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config ---> Running in aa82a7e65c44 Removing intermediate container aa82a7e65c44 ---> c32be86f34f4 Step 17/33 : RUN service ssh start ---> Running in ea87ce51c7b1 Starting OpenBSD Secure Shell server: sshd. Removing intermediate container ea87ce51c7b1 ---> 7ee5e9d3cfe3 Step 18/33 : EXPOSE 2222 ---> Running in 30f044df82d2

On Thu, Mar 21, 2019 at 4:20 PM Patrick notifications@github.com wrote:

CMD [ "yarn", "start" ], you still need to start the ssh service the blessed image uses init_container.sh as an entrypoint to accomplish this

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475439298, or mute the thread https://github.com/notifications/unsubscribe-auth/AJui8O3najS1tjehXZEdQsZ9c8rDHQaMks5vZBPPgaJpZM4bi5hl .

patricklee2 commented 5 years ago

Docker files don't start the start of running processes. So RUN service ssh start won't work. You need an init script to start ssh and yarn.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Matt Webster notifications@github.com Sent: Thursday, March 21, 2019 6:25:29 PM To: MicrosoftDocs/azure-docs Cc: Patrick Lee; Comment Subject: Re: [MicrosoftDocs/azure-docs] SSH instructions for webapps using docker container are incorrect (#26454)

Hi Patrick,

I'm still beating my head against the wall here. The builds and deploys look like they are working but I'm still getting the same error. I'm also still not able to use the webssh portal to connect to my image.

It's likely my script has something wrong with it. I'm not using PM2 so trying to extract the key bits from those examples. Also, I'm not super comfortable with bash scripts and would like to avoid doing too many of these.

My Dockerfile now looks like this:

using the official LTS node image. might try slimmer version at some

point. FROM node:10.15

set working directory and copy over files

WORKDIR /usr/src/app COPY . .

setting environment variables up for Azure staging environment (will use

production for all Azure sites) ENV NODE_ENV=production ENV PORT=443 ENV OPENWEATHER_APIKEY=ccf112262d9e4f0ba12c3cb05a8ba71b ENV ACCUWEATHER_APIKEY=d41dfd5e8a1748d0970cba6637647d96 ENV API_URL=https://dayaxe-web-stage.azurewebsites.net/api/v1/ ENV API_DOMAIN=https://dayaxe-web-stage.azurewebsites.net/ ENV CDN_URL=https://cdn.dayaxe.com

set up OpenSSL and ports for SSH

ENV SSH_PASSWD "root:Docker!" RUN apt-get update \ && apt-get install -y --no-install-recommends dialog \ && apt-get update \ && apt-get install -y --no-install-recommends openssh-server \ && echo "$SSH_PASSWD" | chpasswd

RUN rm -f /etc/ssh/sshd_config COPY sshd_config /etc/ssh/ ENV SSH_PORT 2222 RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config RUN service ssh start EXPOSE 2222

expose some ports for access from web and azure kudu (SCM) container

EXPOSE 443

install and start the project

RUN npm i -g yarn RUN yarn install --prod RUN yarn build

CMD [ "yarn", "start" ]

Here is the relevant part of the build log. Nothing is jumping out at me here, but I'm not sure what I should be looking for.

Step 11/33 : ENV SSH_PASSWD "root:Docker!" ---> Running in c89d35497a3c Removing intermediate container c89d35497a3c ---> 5e4452b269dc Step 12/33 : RUN apt-get update && apt-get install -y --no-install-recommends dialog && apt-get update && apt-get install -y --no-install-recommends openssh-server && echo "$SSH_PASSWD" | chpasswd ---> Running in 86a36cf4e04f Ign:1 http://deb.debian.org/debian stretch InRelease Get:2 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB] Get:3 http://deb.debian.org/debian stretch Release [118 kB] Get:4 http://deb.debian.org/debian stretch Release.gpg [2434 B] Get:5 http://deb.debian.org/debian stretch-updates/main amd64 Packages [11.1 kB] Get:6 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB] Get:7 http://deb.debian.org/debian stretch/main amd64 Packages [7084 kB] Get:8 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [480 kB] Fetched 7880 kB in 1s (5364 kB/s) Reading package lists... Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: dialog 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 262 kB of archives. After this operation, 1138 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian stretch/main amd64 dialog amd64 1.3-20160828-2 [262 kB] debconf: delaying package configuration, since apt-utils is not installedFetched 262 kB in 0s (8832 kB/s)‌ Selecting previously unselected package dialog. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 29978 files and directories currently installed.) Preparing to unpack .../dialog_1.3-20160828-2_amd64.deb ... Unpacking dialog (1.3-20160828-2) ... Setting up dialog (1.3-20160828-2) ... Hit:1 http://security.debian.org/debian-security stretch/updates InRelease Ign:2 http://deb.debian.org/debian stretch InRelease Hit:3 http://deb.debian.org/debian stretch-updates InRelease Hit:4 http://deb.debian.org/debian stretch Release Reading package lists... Reading package lists... Building dependency tree... Reading state information... The following additional packages will be installed: libwrap0 openssh-sftp-server Suggested packages: molly-guard monkeysphere rssh ssh-askpass ufw Recommended packages: tcpd libpam-systemd ncurses-term xauth The following NEW packages will be installed: libwrap0 openssh-server openssh-sftp-server 0 upgraded, 3 newly installed, 0 to remove and 2 not upgraded. Need to get 430 kB of archives. After this operation, 1119 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian stretch/main amd64 libwrap0 amd64 7.6.q-26 [58.2 kB] Get:2 http://security.debian.org/debian-security stretch/updates/main amd64 openssh-sftp-server amd64 1:7.4p1-10+deb9u6 [39.7 kB] Get:3 http://security.debian.org/debian-security stretch/updates/main amd64 openssh-server amd64 1:7.4p1-10+deb9u6 [332 kB] debconf: delaying package configuration, since apt-utils is not installedFetched 430 kB in 0s (19.0 MB/s)‌ Selecting previously unselected package libwrap0:amd64. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 30132 files and directories currently installed.) Preparing to unpack .../libwrap0_7.6.q-26_amd64.deb ... Unpacking libwrap0:amd64 (7.6.q-26) ... Selecting previously unselected package openssh-sftp-server. Preparing to unpack .../openssh-sftp-server_1%3a7.4p1-10+deb9u6_amd64.deb ... Unpacking openssh-sftp-server (1:7.4p1-10+deb9u6) ... Selecting previously unselected package openssh-server. Preparing to unpack .../openssh-server_1%3a7.4p1-10+deb9u6_amd64.deb ... Unpacking openssh-server (1:7.4p1-10+deb9u6) ... Setting up openssh-sftp-server (1:7.4p1-10+deb9u6) ... Processing triggers for libc-bin (2.24-11+deb9u4) ... Setting up libwrap0:amd64 (7.6.q-26) ... Setting up openssh-server (1:7.4p1-10+deb9u6) ... debconf: unable to initialize frontend: Dialog debconf: (TERM is not set, so the dialog frontend is not usable.) debconf: falling back to frontend: Readline

Creating config file /etc/ssh/sshd_config with new version Creating SSH2 RSA key; this may take some time ... 2048 SHA256:s5x/tFiaSyeij/e9mx6EKSClr5rd2cqu4FcxtGT9LP4 root@86a36cf4e04f (RSA) Creating SSH2 ECDSA key; this may take some time ... 256 SHA256:syiIWD5nialzaKzIW05C5b4ZWjaq97760W++tM0lzLQ root@86a36cf4e04f (ECDSA) Creating SSH2 ED25519 key; this may take some time ... 256 SHA256:CnIVQy7E87c5Cu1T5H+F3WtqeO/ciOeiBQoDnknEyfA root@86a36cf4e04f (ED25519) invoke-rc.d: could not determine current runlevel invoke-rc.d: policy-rc.d denied execution of start. Processing triggers for libc-bin (2.24-11+deb9u4) ... Removing intermediate container 86a36cf4e04f ---> e46d47d633d3 Step 13/33 : RUN rm -f /etc/ssh/sshd_config ---> Running in e2c346714a10 Removing intermediate container e2c346714a10 ---> 4fddc2236c33 Step 14/33 : COPY sshd_config /etc/ssh/ ---> c0f09eadf98f Step 15/33 : ENV SSH_PORT 2222 ---> Running in e3bb2a4dcd47 Removing intermediate container e3bb2a4dcd47 ---> b9b5bb428816 Step 16/33 : RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config ---> Running in aa82a7e65c44 Removing intermediate container aa82a7e65c44 ---> c32be86f34f4 Step 17/33 : RUN service ssh start ---> Running in ea87ce51c7b1 Starting OpenBSD Secure Shell server: sshd. Removing intermediate container ea87ce51c7b1 ---> 7ee5e9d3cfe3 Step 18/33 : EXPOSE 2222 ---> Running in 30f044df82d2

On Thu, Mar 21, 2019 at 4:20 PM Patrick notifications@github.com wrote:

CMD [ "yarn", "start" ], you still need to start the ssh service the blessed image uses init_container.sh as an entrypoint to accomplish this

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475439298, or mute the thread https://github.com/notifications/unsubscribe-auth/AJui8O3najS1tjehXZEdQsZ9c8rDHQaMks5vZBPPgaJpZM4bi5hl .

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftDocs%2Fazure-docs%2Fissues%2F26454%23issuecomment-475461631&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9a446f3216b941d4fbd108d6ae654544%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888147322181384&sdata=alSSigi1DjY4TEmxW%2BfuAWWgmiX1rb4u3BP%2FIRIkBKE%3D&reserved=0, or mute the threadhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAeRjbZnSCMI8K8z2kVoxExKQhK4vvXceks5vZDEJgaJpZM4bi5hl&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9a446f3216b941d4fbd108d6ae654544%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888147322191378&sdata=hUQYnESbVVav0hP4%2BYB6Q5rv9P0858d6dsRFBwE8hsc%3D&reserved=0.

mattyweb commented 5 years ago

Hi Patrick,

Still working on this. Currently, I have everything working fine locally and am able to build and run the image and SSH to it on my machine.

However, the build is failing in Azure. The issue I'm running into now is trying to overwrite the sshd_config file on the image. I've tried several combinations of COPY and RUN cp or RUN mv, tried starting with the sshd_config in the root versus the azure_startup directory, tried renaming the azure_startup directory (in case that was some kind of a keyword) all without success. Whatever I try ends up with some form of "COPY failed: stat ... sshd_config: no such file or directory"

Any more ideas? Given that SSH is working locally I'm thinking there may be some nuance to the Azure docker environment that I'm missing...

The full Dockerfile is here:

using the official LTS node image. might try slimmer version at some

point. FROM node:10.15

set working directory and copy over files

WORKDIR /usr/src/app COPY . .

setting environment variables up for Azure staging environment (will use

production for all Azure sites) ENV NODE_ENV=production ENV PORT=3001 ENV OPENWEATHER_APIKEY=ccf112262d9e4f0ba12c3cb05a8ba71b ENV ACCUWEATHER_APIKEY=d41dfd5e8a1748d0970cba6637647d96 ENV API_URL=https://dayaxe-web-stage.azurewebsites.net/api/v1/ ENV API_DOMAIN=https://dayaxe-web-stage.azurewebsites.net/ ENV CDN_URL=https://cdn.dayaxe.com

set up OpenSSL and ports for SSH

ENV SSH_PASSWD "root:Docker!" RUN apt-get update \ && apt-get install -y --no-install-recommends dialog \ && apt-get update \ && apt-get install -y --no-install-recommends openssh-server \ && echo "$SSH_PASSWD" | chpasswd

RUN rm -f /etc/ssh/sshd_config RUN echo $PWD RUN echo $(ls -al azure_startup) COPY azure_startup/sshd_config /etc/ssh/ ENV SSH_PORT 2222 RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config RUN chmod 755 azure_startup/docker_init.sh ENV PATH ${PATH}:azure_startup

expose some ports for access from web and azure kudu (SCM) container

EXPOSE 2222 EXPOSE 3001

install and start the project

RUN npm i -g yarn RUN yarn install --prod RUN yarn build

ENTRYPOINT ["azure_startup/docker_init.sh"]

On Thu, Mar 21, 2019 at 6:43 PM Patrick notifications@github.com wrote:

Docker files don't start the start of running processes. So RUN service ssh start won't work. You need an init script to start ssh and yarn.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Matt Webster notifications@github.com Sent: Thursday, March 21, 2019 6:25:29 PM To: MicrosoftDocs/azure-docs Cc: Patrick Lee; Comment Subject: Re: [MicrosoftDocs/azure-docs] SSH instructions for webapps using docker container are incorrect (#26454)

Hi Patrick,

I'm still beating my head against the wall here. The builds and deploys look like they are working but I'm still getting the same error. I'm also still not able to use the webssh portal to connect to my image.

It's likely my script has something wrong with it. I'm not using PM2 so trying to extract the key bits from those examples. Also, I'm not super comfortable with bash scripts and would like to avoid doing too many of these.

My Dockerfile now looks like this:

using the official LTS node image. might try slimmer version at some

point. FROM node:10.15

set working directory and copy over files

WORKDIR /usr/src/app COPY . .

setting environment variables up for Azure staging environment (will use

production for all Azure sites) ENV NODE_ENV=production ENV PORT=443 ENV OPENWEATHER_APIKEY=ccf112262d9e4f0ba12c3cb05a8ba71b ENV ACCUWEATHER_APIKEY=d41dfd5e8a1748d0970cba6637647d96 ENV API_URL=https://dayaxe-web-stage.azurewebsites.net/api/v1/ ENV API_DOMAIN=https://dayaxe-web-stage.azurewebsites.net/ ENV CDN_URL=https://cdn.dayaxe.com

set up OpenSSL and ports for SSH

ENV SSH_PASSWD "root:Docker!" RUN apt-get update \ && apt-get install -y --no-install-recommends dialog \ && apt-get update \ && apt-get install -y --no-install-recommends openssh-server \ && echo "$SSH_PASSWD" | chpasswd

RUN rm -f /etc/ssh/sshd_config COPY sshd_config /etc/ssh/ ENV SSH_PORT 2222 RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config RUN service ssh start EXPOSE 2222

expose some ports for access from web and azure kudu (SCM) container

EXPOSE 443

install and start the project

RUN npm i -g yarn RUN yarn install --prod RUN yarn build

CMD [ "yarn", "start" ]

Here is the relevant part of the build log. Nothing is jumping out at me here, but I'm not sure what I should be looking for.

Step 11/33 : ENV SSH_PASSWD "root:Docker!" ---> Running in c89d35497a3c Removing intermediate container c89d35497a3c ---> 5e4452b269dc Step 12/33 : RUN apt-get update && apt-get install -y --no-install-recommends dialog && apt-get update && apt-get install -y --no-install-recommends openssh-server && echo "$SSH_PASSWD" | chpasswd ---> Running in 86a36cf4e04f Ign:1 http://deb.debian.org/debian stretch InRelease Get:2 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB] Get:3 http://deb.debian.org/debian stretch Release [118 kB] Get:4 http://deb.debian.org/debian stretch Release.gpg [2434 B] Get:5 http://deb.debian.org/debian stretch-updates/main amd64 Packages [11.1 kB] Get:6 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB] Get:7 http://deb.debian.org/debian stretch/main amd64 Packages [7084 kB] Get:8 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [480 kB] Fetched 7880 kB in 1s (5364 kB/s) Reading package lists... Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: dialog 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 262 kB of archives. After this operation, 1138 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian stretch/main amd64 dialog amd64 1.3-20160828-2 [262 kB] debconf: delaying package configuration, since apt-utils is not installedFetched 262 kB in 0s (8832 kB/s)‌ Selecting previously unselected package dialog. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 29978 files and directories currently installed.) Preparing to unpack .../dialog_1.3-20160828-2_amd64.deb ... Unpacking dialog (1.3-20160828-2) ... Setting up dialog (1.3-20160828-2) ... Hit:1 http://security.debian.org/debian-security stretch/updates InRelease Ign:2 http://deb.debian.org/debian stretch InRelease Hit:3 http://deb.debian.org/debian stretch-updates InRelease Hit:4 http://deb.debian.org/debian stretch Release Reading package lists... Reading package lists... Building dependency tree... Reading state information... The following additional packages will be installed: libwrap0 openssh-sftp-server Suggested packages: molly-guard monkeysphere rssh ssh-askpass ufw Recommended packages: tcpd libpam-systemd ncurses-term xauth The following NEW packages will be installed: libwrap0 openssh-server openssh-sftp-server 0 upgraded, 3 newly installed, 0 to remove and 2 not upgraded. Need to get 430 kB of archives. After this operation, 1119 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian stretch/main amd64 libwrap0 amd64 7.6.q-26 [58.2 kB] Get:2 http://security.debian.org/debian-security stretch/updates/main amd64 openssh-sftp-server amd64 1:7.4p1-10+deb9u6 [39.7 kB] Get:3 http://security.debian.org/debian-security stretch/updates/main amd64 openssh-server amd64 1:7.4p1-10+deb9u6 [332 kB] debconf: delaying package configuration, since apt-utils is not installedFetched 430 kB in 0s (19.0 MB/s)‌ Selecting previously unselected package libwrap0:amd64. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 30132 files and directories currently installed.) Preparing to unpack .../libwrap0_7.6.q-26_amd64.deb ... Unpacking libwrap0:amd64 (7.6.q-26) ... Selecting previously unselected package openssh-sftp-server. Preparing to unpack .../openssh-sftp-server_1%3a7.4p1-10+deb9u6_amd64.deb ... Unpacking openssh-sftp-server (1:7.4p1-10+deb9u6) ... Selecting previously unselected package openssh-server. Preparing to unpack .../openssh-server_1%3a7.4p1-10+deb9u6_amd64.deb ... Unpacking openssh-server (1:7.4p1-10+deb9u6) ... Setting up openssh-sftp-server (1:7.4p1-10+deb9u6) ... Processing triggers for libc-bin (2.24-11+deb9u4) ... Setting up libwrap0:amd64 (7.6.q-26) ... Setting up openssh-server (1:7.4p1-10+deb9u6) ... debconf: unable to initialize frontend: Dialog debconf: (TERM is not set, so the dialog frontend is not usable.) debconf: falling back to frontend: Readline

Creating config file /etc/ssh/sshd_config with new version Creating SSH2 RSA key; this may take some time ... 2048 SHA256:s5x/tFiaSyeij/e9mx6EKSClr5rd2cqu4FcxtGT9LP4 root@86a36cf4e04f (RSA) Creating SSH2 ECDSA key; this may take some time ... 256 SHA256:syiIWD5nialzaKzIW05C5b4ZWjaq97760W++tM0lzLQ root@86a36cf4e04f (ECDSA) Creating SSH2 ED25519 key; this may take some time ... 256 SHA256:CnIVQy7E87c5Cu1T5H+F3WtqeO/ciOeiBQoDnknEyfA root@86a36cf4e04f (ED25519) invoke-rc.d: could not determine current runlevel invoke-rc.d: policy-rc.d denied execution of start. Processing triggers for libc-bin (2.24-11+deb9u4) ... Removing intermediate container 86a36cf4e04f ---> e46d47d633d3 Step 13/33 : RUN rm -f /etc/ssh/sshd_config ---> Running in e2c346714a10 Removing intermediate container e2c346714a10 ---> 4fddc2236c33 Step 14/33 : COPY sshd_config /etc/ssh/ ---> c0f09eadf98f Step 15/33 : ENV SSH_PORT 2222 ---> Running in e3bb2a4dcd47 Removing intermediate container e3bb2a4dcd47 ---> b9b5bb428816 Step 16/33 : RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config ---> Running in aa82a7e65c44 Removing intermediate container aa82a7e65c44 ---> c32be86f34f4 Step 17/33 : RUN service ssh start ---> Running in ea87ce51c7b1 Starting OpenBSD Secure Shell server: sshd. Removing intermediate container ea87ce51c7b1 ---> 7ee5e9d3cfe3 Step 18/33 : EXPOSE 2222 ---> Running in 30f044df82d2

On Thu, Mar 21, 2019 at 4:20 PM Patrick notifications@github.com wrote:

CMD [ "yarn", "start" ], you still need to start the ssh service the blessed image uses init_container.sh as an entrypoint to accomplish this

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475439298 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AJui8O3najS1tjehXZEdQsZ9c8rDHQaMks5vZBPPgaJpZM4bi5hl

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub< https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftDocs%2Fazure-docs%2Fissues%2F26454%23issuecomment-475461631&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9a446f3216b941d4fbd108d6ae654544%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888147322181384&sdata=alSSigi1DjY4TEmxW%2BfuAWWgmiX1rb4u3BP%2FIRIkBKE%3D&reserved=0>, or mute the thread< https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAeRjbZnSCMI8K8z2kVoxExKQhK4vvXceks5vZDEJgaJpZM4bi5hl&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9a446f3216b941d4fbd108d6ae654544%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888147322191378&sdata=hUQYnESbVVav0hP4%2BYB6Q5rv9P0858d6dsRFBwE8hsc%3D&reserved=0

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475464703, or mute the thread https://github.com/notifications/unsubscribe-auth/AJui8K0n0341zGGTvSHvor643NLpjG3tks5vZDU6gaJpZM4bi5hl .

mattyweb commented 5 years ago

I should add that when running in the Azure Pipeline those echo lines show the PWD as /usr/src/app as expected but the azure_startup directory doesn't seem to be there.

Also, I am also starting the container locally with "docker run -p 4000:2222 -p 4004:3001 dayaxe-web" but obviously haven't gotten to that point in Azure as builds aren't working yet.

On Fri, Mar 22, 2019 at 10:59 AM Matt Webster mattyweb@gmail.com wrote:

Hi Patrick,

Still working on this. Currently, I have everything working fine locally and am able to build and run the image and SSH to it on my machine.

However, the build is failing in Azure. The issue I'm running into now is trying to overwrite the sshd_config file on the image. I've tried several combinations of COPY and RUN cp or RUN mv, tried starting with the sshd_config in the root versus the azure_startup directory, tried renaming the azure_startup directory (in case that was some kind of a keyword) all without success. Whatever I try ends up with some form of "COPY failed: stat ... sshd_config: no such file or directory"

Any more ideas? Given that SSH is working locally I'm thinking there may be some nuance to the Azure docker environment that I'm missing...

The full Dockerfile is here:

using the official LTS node image. might try slimmer version at some

point. FROM node:10.15

set working directory and copy over files

WORKDIR /usr/src/app COPY . .

setting environment variables up for Azure staging environment (will use

production for all Azure sites) ENV NODE_ENV=production ENV PORT=3001 ENV OPENWEATHER_APIKEY=ccf112262d9e4f0ba12c3cb05a8ba71b ENV ACCUWEATHER_APIKEY=d41dfd5e8a1748d0970cba6637647d96 ENV API_URL=https://dayaxe-web-stage.azurewebsites.net/api/v1/ ENV API_DOMAIN=https://dayaxe-web-stage.azurewebsites.net/ ENV CDN_URL=https://cdn.dayaxe.com

set up OpenSSL and ports for SSH

ENV SSH_PASSWD "root:Docker!" RUN apt-get update \ && apt-get install -y --no-install-recommends dialog \ && apt-get update \ && apt-get install -y --no-install-recommends openssh-server \ && echo "$SSH_PASSWD" | chpasswd

RUN rm -f /etc/ssh/sshd_config RUN echo $PWD RUN echo $(ls -al azure_startup) COPY azure_startup/sshd_config /etc/ssh/ ENV SSH_PORT 2222 RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config RUN chmod 755 azure_startup/docker_init.sh ENV PATH ${PATH}:azure_startup

expose some ports for access from web and azure kudu (SCM) container

EXPOSE 2222 EXPOSE 3001

install and start the project

RUN npm i -g yarn RUN yarn install --prod RUN yarn build

ENTRYPOINT ["azure_startup/docker_init.sh"]

On Thu, Mar 21, 2019 at 6:43 PM Patrick notifications@github.com wrote:

Docker files don't start the start of running processes. So RUN service ssh start won't work. You need an init script to start ssh and yarn.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Matt Webster notifications@github.com Sent: Thursday, March 21, 2019 6:25:29 PM To: MicrosoftDocs/azure-docs Cc: Patrick Lee; Comment Subject: Re: [MicrosoftDocs/azure-docs] SSH instructions for webapps using docker container are incorrect (#26454)

Hi Patrick,

I'm still beating my head against the wall here. The builds and deploys look like they are working but I'm still getting the same error. I'm also still not able to use the webssh portal to connect to my image.

It's likely my script has something wrong with it. I'm not using PM2 so trying to extract the key bits from those examples. Also, I'm not super comfortable with bash scripts and would like to avoid doing too many of these.

My Dockerfile now looks like this:

using the official LTS node image. might try slimmer version at some

point. FROM node:10.15

set working directory and copy over files

WORKDIR /usr/src/app COPY . .

setting environment variables up for Azure staging environment (will use

production for all Azure sites) ENV NODE_ENV=production ENV PORT=443 ENV OPENWEATHER_APIKEY=ccf112262d9e4f0ba12c3cb05a8ba71b ENV ACCUWEATHER_APIKEY=d41dfd5e8a1748d0970cba6637647d96 ENV API_URL=https://dayaxe-web-stage.azurewebsites.net/api/v1/ ENV API_DOMAIN=https://dayaxe-web-stage.azurewebsites.net/ ENV CDN_URL=https://cdn.dayaxe.com

set up OpenSSL and ports for SSH

ENV SSH_PASSWD "root:Docker!" RUN apt-get update \ && apt-get install -y --no-install-recommends dialog \ && apt-get update \ && apt-get install -y --no-install-recommends openssh-server \ && echo "$SSH_PASSWD" | chpasswd

RUN rm -f /etc/ssh/sshd_config COPY sshd_config /etc/ssh/ ENV SSH_PORT 2222 RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config RUN service ssh start EXPOSE 2222

expose some ports for access from web and azure kudu (SCM) container

EXPOSE 443

install and start the project

RUN npm i -g yarn RUN yarn install --prod RUN yarn build

CMD [ "yarn", "start" ]

Here is the relevant part of the build log. Nothing is jumping out at me here, but I'm not sure what I should be looking for.

Step 11/33 : ENV SSH_PASSWD "root:Docker!" ---> Running in c89d35497a3c Removing intermediate container c89d35497a3c ---> 5e4452b269dc Step 12/33 : RUN apt-get update && apt-get install -y --no-install-recommends dialog && apt-get update && apt-get install -y --no-install-recommends openssh-server && echo "$SSH_PASSWD" | chpasswd ---> Running in 86a36cf4e04f Ign:1 http://deb.debian.org/debian stretch InRelease Get:2 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB] Get:3 http://deb.debian.org/debian stretch Release [118 kB] Get:4 http://deb.debian.org/debian stretch Release.gpg [2434 B] Get:5 http://deb.debian.org/debian stretch-updates/main amd64 Packages [11.1 kB] Get:6 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB] Get:7 http://deb.debian.org/debian stretch/main amd64 Packages [7084 kB] Get:8 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [480 kB] Fetched 7880 kB in 1s (5364 kB/s) Reading package lists... Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: dialog 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 262 kB of archives. After this operation, 1138 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian stretch/main amd64 dialog amd64 1.3-20160828-2 [262 kB] debconf: delaying package configuration, since apt-utils is not installedFetched 262 kB in 0s (8832 kB/s)‌ Selecting previously unselected package dialog. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 29978 files and directories currently installed.) Preparing to unpack .../dialog_1.3-20160828-2_amd64.deb ... Unpacking dialog (1.3-20160828-2) ... Setting up dialog (1.3-20160828-2) ... Hit:1 http://security.debian.org/debian-security stretch/updates InRelease Ign:2 http://deb.debian.org/debian stretch InRelease Hit:3 http://deb.debian.org/debian stretch-updates InRelease Hit:4 http://deb.debian.org/debian stretch Release Reading package lists... Reading package lists... Building dependency tree... Reading state information... The following additional packages will be installed: libwrap0 openssh-sftp-server Suggested packages: molly-guard monkeysphere rssh ssh-askpass ufw Recommended packages: tcpd libpam-systemd ncurses-term xauth The following NEW packages will be installed: libwrap0 openssh-server openssh-sftp-server 0 upgraded, 3 newly installed, 0 to remove and 2 not upgraded. Need to get 430 kB of archives. After this operation, 1119 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian stretch/main amd64 libwrap0 amd64 7.6.q-26 [58.2 kB] Get:2 http://security.debian.org/debian-security stretch/updates/main amd64 openssh-sftp-server amd64 1:7.4p1-10+deb9u6 [39.7 kB] Get:3 http://security.debian.org/debian-security stretch/updates/main amd64 openssh-server amd64 1:7.4p1-10+deb9u6 [332 kB] debconf: delaying package configuration, since apt-utils is not installedFetched 430 kB in 0s (19.0 MB/s)‌ Selecting previously unselected package libwrap0:amd64. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 30132 files and directories currently installed.) Preparing to unpack .../libwrap0_7.6.q-26_amd64.deb ... Unpacking libwrap0:amd64 (7.6.q-26) ... Selecting previously unselected package openssh-sftp-server. Preparing to unpack .../openssh-sftp-server_1%3a7.4p1-10+deb9u6_amd64.deb ... Unpacking openssh-sftp-server (1:7.4p1-10+deb9u6) ... Selecting previously unselected package openssh-server. Preparing to unpack .../openssh-server_1%3a7.4p1-10+deb9u6_amd64.deb ... Unpacking openssh-server (1:7.4p1-10+deb9u6) ... Setting up openssh-sftp-server (1:7.4p1-10+deb9u6) ... Processing triggers for libc-bin (2.24-11+deb9u4) ... Setting up libwrap0:amd64 (7.6.q-26) ... Setting up openssh-server (1:7.4p1-10+deb9u6) ... debconf: unable to initialize frontend: Dialog debconf: (TERM is not set, so the dialog frontend is not usable.) debconf: falling back to frontend: Readline

Creating config file /etc/ssh/sshd_config with new version Creating SSH2 RSA key; this may take some time ... 2048 SHA256:s5x/tFiaSyeij/e9mx6EKSClr5rd2cqu4FcxtGT9LP4 root@86a36cf4e04f (RSA) Creating SSH2 ECDSA key; this may take some time ... 256 SHA256:syiIWD5nialzaKzIW05C5b4ZWjaq97760W++tM0lzLQ root@86a36cf4e04f (ECDSA) Creating SSH2 ED25519 key; this may take some time ... 256 SHA256:CnIVQy7E87c5Cu1T5H+F3WtqeO/ciOeiBQoDnknEyfA root@86a36cf4e04f (ED25519) invoke-rc.d: could not determine current runlevel invoke-rc.d: policy-rc.d denied execution of start. Processing triggers for libc-bin (2.24-11+deb9u4) ... Removing intermediate container 86a36cf4e04f ---> e46d47d633d3 Step 13/33 : RUN rm -f /etc/ssh/sshd_config ---> Running in e2c346714a10 Removing intermediate container e2c346714a10 ---> 4fddc2236c33 Step 14/33 : COPY sshd_config /etc/ssh/ ---> c0f09eadf98f Step 15/33 : ENV SSH_PORT 2222 ---> Running in e3bb2a4dcd47 Removing intermediate container e3bb2a4dcd47 ---> b9b5bb428816 Step 16/33 : RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config ---> Running in aa82a7e65c44 Removing intermediate container aa82a7e65c44 ---> c32be86f34f4 Step 17/33 : RUN service ssh start ---> Running in ea87ce51c7b1 Starting OpenBSD Secure Shell server: sshd. Removing intermediate container ea87ce51c7b1 ---> 7ee5e9d3cfe3 Step 18/33 : EXPOSE 2222 ---> Running in 30f044df82d2

On Thu, Mar 21, 2019 at 4:20 PM Patrick notifications@github.com wrote:

CMD [ "yarn", "start" ], you still need to start the ssh service the blessed image uses init_container.sh as an entrypoint to accomplish this

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475439298 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AJui8O3najS1tjehXZEdQsZ9c8rDHQaMks5vZBPPgaJpZM4bi5hl

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub< https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftDocs%2Fazure-docs%2Fissues%2F26454%23issuecomment-475461631&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9a446f3216b941d4fbd108d6ae654544%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888147322181384&sdata=alSSigi1DjY4TEmxW%2BfuAWWgmiX1rb4u3BP%2FIRIkBKE%3D&reserved=0>, or mute the thread< https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAeRjbZnSCMI8K8z2kVoxExKQhK4vvXceks5vZDEJgaJpZM4bi5hl&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9a446f3216b941d4fbd108d6ae654544%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888147322191378&sdata=hUQYnESbVVav0hP4%2BYB6Q5rv9P0858d6dsRFBwE8hsc%3D&reserved=0

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475464703, or mute the thread https://github.com/notifications/unsubscribe-auth/AJui8K0n0341zGGTvSHvor643NLpjG3tks5vZDU6gaJpZM4bi5hl .

patricklee2 commented 5 years ago

Can you share the rest of the code on GitHub?

Get Outlook for Androidhttps://aka.ms/ghei36


From: Matt Webster notifications@github.com Sent: Friday, March 22, 2019 11:07:56 AM To: MicrosoftDocs/azure-docs Cc: Patrick Lee; Comment Subject: Re: [MicrosoftDocs/azure-docs] SSH instructions for webapps using docker container are incorrect (#26454)

I should add that when running in the Azure Pipeline those echo lines show the PWD as /usr/src/app as expected but the azure_startup directory doesn't seem to be there.

Also, I am also starting the container locally with "docker run -p 4000:2222 -p 4004:3001 dayaxe-web" but obviously haven't gotten to that point in Azure as builds aren't working yet.

On Fri, Mar 22, 2019 at 10:59 AM Matt Webster mattyweb@gmail.com wrote:

Hi Patrick,

Still working on this. Currently, I have everything working fine locally and am able to build and run the image and SSH to it on my machine.

However, the build is failing in Azure. The issue I'm running into now is trying to overwrite the sshd_config file on the image. I've tried several combinations of COPY and RUN cp or RUN mv, tried starting with the sshd_config in the root versus the azure_startup directory, tried renaming the azure_startup directory (in case that was some kind of a keyword) all without success. Whatever I try ends up with some form of "COPY failed: stat ... sshd_config: no such file or directory"

Any more ideas? Given that SSH is working locally I'm thinking there may be some nuance to the Azure docker environment that I'm missing...

The full Dockerfile is here:

using the official LTS node image. might try slimmer version at some

point. FROM node:10.15

set working directory and copy over files

WORKDIR /usr/src/app COPY . .

setting environment variables up for Azure staging environment (will use

production for all Azure sites) ENV NODE_ENV=production ENV PORT=3001 ENV OPENWEATHER_APIKEY=ccf112262d9e4f0ba12c3cb05a8ba71b ENV ACCUWEATHER_APIKEY=d41dfd5e8a1748d0970cba6637647d96 ENV API_URL=https://dayaxe-web-stage.azurewebsites.net/api/v1/ ENV API_DOMAIN=https://dayaxe-web-stage.azurewebsites.net/ ENV CDN_URL=https://cdn.dayaxe.com

set up OpenSSL and ports for SSH

ENV SSH_PASSWD "root:Docker!" RUN apt-get update \ && apt-get install -y --no-install-recommends dialog \ && apt-get update \ && apt-get install -y --no-install-recommends openssh-server \ && echo "$SSH_PASSWD" | chpasswd

RUN rm -f /etc/ssh/sshd_config RUN echo $PWD RUN echo $(ls -al azure_startup) COPY azure_startup/sshd_config /etc/ssh/ ENV SSH_PORT 2222 RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config RUN chmod 755 azure_startup/docker_init.sh ENV PATH ${PATH}:azure_startup

expose some ports for access from web and azure kudu (SCM) container

EXPOSE 2222 EXPOSE 3001

install and start the project

RUN npm i -g yarn RUN yarn install --prod RUN yarn build

ENTRYPOINT ["azure_startup/docker_init.sh"]

On Thu, Mar 21, 2019 at 6:43 PM Patrick notifications@github.com wrote:

Docker files don't start the start of running processes. So RUN service ssh start won't work. You need an init script to start ssh and yarn.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Matt Webster notifications@github.com Sent: Thursday, March 21, 2019 6:25:29 PM To: MicrosoftDocs/azure-docs Cc: Patrick Lee; Comment Subject: Re: [MicrosoftDocs/azure-docs] SSH instructions for webapps using docker container are incorrect (#26454)

Hi Patrick,

I'm still beating my head against the wall here. The builds and deploys look like they are working but I'm still getting the same error. I'm also still not able to use the webssh portal to connect to my image.

It's likely my script has something wrong with it. I'm not using PM2 so trying to extract the key bits from those examples. Also, I'm not super comfortable with bash scripts and would like to avoid doing too many of these.

My Dockerfile now looks like this:

using the official LTS node image. might try slimmer version at some

point. FROM node:10.15

set working directory and copy over files

WORKDIR /usr/src/app COPY . .

setting environment variables up for Azure staging environment (will use

production for all Azure sites) ENV NODE_ENV=production ENV PORT=443 ENV OPENWEATHER_APIKEY=ccf112262d9e4f0ba12c3cb05a8ba71b ENV ACCUWEATHER_APIKEY=d41dfd5e8a1748d0970cba6637647d96 ENV API_URL=https://dayaxe-web-stage.azurewebsites.net/api/v1/ ENV API_DOMAIN=https://dayaxe-web-stage.azurewebsites.net/ ENV CDN_URL=https://cdn.dayaxe.com

set up OpenSSL and ports for SSH

ENV SSH_PASSWD "root:Docker!" RUN apt-get update \ && apt-get install -y --no-install-recommends dialog \ && apt-get update \ && apt-get install -y --no-install-recommends openssh-server \ && echo "$SSH_PASSWD" | chpasswd

RUN rm -f /etc/ssh/sshd_config COPY sshd_config /etc/ssh/ ENV SSH_PORT 2222 RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config RUN service ssh start EXPOSE 2222

expose some ports for access from web and azure kudu (SCM) container

EXPOSE 443

install and start the project

RUN npm i -g yarn RUN yarn install --prod RUN yarn build

CMD [ "yarn", "start" ]

Here is the relevant part of the build log. Nothing is jumping out at me here, but I'm not sure what I should be looking for.

Step 11/33 : ENV SSH_PASSWD "root:Docker!" ---> Running in c89d35497a3c Removing intermediate container c89d35497a3c ---> 5e4452b269dc Step 12/33 : RUN apt-get update && apt-get install -y --no-install-recommends dialog && apt-get update && apt-get install -y --no-install-recommends openssh-server && echo "$SSH_PASSWD" | chpasswd ---> Running in 86a36cf4e04f Ign:1 http://deb.debian.org/debian stretch InRelease Get:2 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB] Get:3 http://deb.debian.org/debian stretch Release [118 kB] Get:4 http://deb.debian.org/debian stretch Release.gpg [2434 B] Get:5 http://deb.debian.org/debian stretch-updates/main amd64 Packages [11.1 kB] Get:6 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB] Get:7 http://deb.debian.org/debian stretch/main amd64 Packages [7084 kB] Get:8 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [480 kB] Fetched 7880 kB in 1s (5364 kB/s) Reading package lists... Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: dialog 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 262 kB of archives. After this operation, 1138 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian stretch/main amd64 dialog amd64 1.3-20160828-2 [262 kB] debconf: delaying package configuration, since apt-utils is not installedFetched 262 kB in 0s (8832 kB/s)‌ Selecting previously unselected package dialog. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 29978 files and directories currently installed.) Preparing to unpack .../dialog_1.3-20160828-2_amd64.deb ... Unpacking dialog (1.3-20160828-2) ... Setting up dialog (1.3-20160828-2) ... Hit:1 http://security.debian.org/debian-security stretch/updates InRelease Ign:2 http://deb.debian.org/debian stretch InRelease Hit:3 http://deb.debian.org/debian stretch-updates InRelease Hit:4 http://deb.debian.org/debian stretch Release Reading package lists... Reading package lists... Building dependency tree... Reading state information... The following additional packages will be installed: libwrap0 openssh-sftp-server Suggested packages: molly-guard monkeysphere rssh ssh-askpass ufw Recommended packages: tcpd libpam-systemd ncurses-term xauth The following NEW packages will be installed: libwrap0 openssh-server openssh-sftp-server 0 upgraded, 3 newly installed, 0 to remove and 2 not upgraded. Need to get 430 kB of archives. After this operation, 1119 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian stretch/main amd64 libwrap0 amd64 7.6.q-26 [58.2 kB] Get:2 http://security.debian.org/debian-security stretch/updates/main amd64 openssh-sftp-server amd64 1:7.4p1-10+deb9u6 [39.7 kB] Get:3 http://security.debian.org/debian-security stretch/updates/main amd64 openssh-server amd64 1:7.4p1-10+deb9u6 [332 kB] debconf: delaying package configuration, since apt-utils is not installedFetched 430 kB in 0s (19.0 MB/s)‌ Selecting previously unselected package libwrap0:amd64. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 30132 files and directories currently installed.) Preparing to unpack .../libwrap0_7.6.q-26_amd64.deb ... Unpacking libwrap0:amd64 (7.6.q-26) ... Selecting previously unselected package openssh-sftp-server. Preparing to unpack .../openssh-sftp-server_1%3a7.4p1-10+deb9u6_amd64.deb ... Unpacking openssh-sftp-server (1:7.4p1-10+deb9u6) ... Selecting previously unselected package openssh-server. Preparing to unpack .../openssh-server_1%3a7.4p1-10+deb9u6_amd64.deb ... Unpacking openssh-server (1:7.4p1-10+deb9u6) ... Setting up openssh-sftp-server (1:7.4p1-10+deb9u6) ... Processing triggers for libc-bin (2.24-11+deb9u4) ... Setting up libwrap0:amd64 (7.6.q-26) ... Setting up openssh-server (1:7.4p1-10+deb9u6) ... debconf: unable to initialize frontend: Dialog debconf: (TERM is not set, so the dialog frontend is not usable.) debconf: falling back to frontend: Readline

Creating config file /etc/ssh/sshd_config with new version Creating SSH2 RSA key; this may take some time ... 2048 SHA256:s5x/tFiaSyeij/e9mx6EKSClr5rd2cqu4FcxtGT9LP4 root@86a36cf4e04f (RSA) Creating SSH2 ECDSA key; this may take some time ... 256 SHA256:syiIWD5nialzaKzIW05C5b4ZWjaq97760W++tM0lzLQ root@86a36cf4e04f (ECDSA) Creating SSH2 ED25519 key; this may take some time ... 256 SHA256:CnIVQy7E87c5Cu1T5H+F3WtqeO/ciOeiBQoDnknEyfA root@86a36cf4e04f (ED25519) invoke-rc.d: could not determine current runlevel invoke-rc.d: policy-rc.d denied execution of start. Processing triggers for libc-bin (2.24-11+deb9u4) ... Removing intermediate container 86a36cf4e04f ---> e46d47d633d3 Step 13/33 : RUN rm -f /etc/ssh/sshd_config ---> Running in e2c346714a10 Removing intermediate container e2c346714a10 ---> 4fddc2236c33 Step 14/33 : COPY sshd_config /etc/ssh/ ---> c0f09eadf98f Step 15/33 : ENV SSH_PORT 2222 ---> Running in e3bb2a4dcd47 Removing intermediate container e3bb2a4dcd47 ---> b9b5bb428816 Step 16/33 : RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config ---> Running in aa82a7e65c44 Removing intermediate container aa82a7e65c44 ---> c32be86f34f4 Step 17/33 : RUN service ssh start ---> Running in ea87ce51c7b1 Starting OpenBSD Secure Shell server: sshd. Removing intermediate container ea87ce51c7b1 ---> 7ee5e9d3cfe3 Step 18/33 : EXPOSE 2222 ---> Running in 30f044df82d2

On Thu, Mar 21, 2019 at 4:20 PM Patrick notifications@github.com wrote:

CMD [ "yarn", "start" ], you still need to start the ssh service the blessed image uses init_container.sh as an entrypoint to accomplish this

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475439298 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AJui8O3najS1tjehXZEdQsZ9c8rDHQaMks5vZBPPgaJpZM4bi5hl

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub< https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftDocs%2Fazure-docs%2Fissues%2F26454%23issuecomment-475461631&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9a446f3216b941d4fbd108d6ae654544%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888147322181384&sdata=alSSigi1DjY4TEmxW%2BfuAWWgmiX1rb4u3BP%2FIRIkBKE%3D&reserved=0>, or mute the thread< https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAeRjbZnSCMI8K8z2kVoxExKQhK4vvXceks5vZDEJgaJpZM4bi5hl&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9a446f3216b941d4fbd108d6ae654544%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888147322191378&sdata=hUQYnESbVVav0hP4%2BYB6Q5rv9P0858d6dsRFBwE8hsc%3D&reserved=0

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475464703, or mute the thread https://github.com/notifications/unsubscribe-auth/AJui8K0n0341zGGTvSHvor643NLpjG3tks5vZDU6gaJpZM4bi5hl .

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftDocs%2Fazure-docs%2Fissues%2F26454%23issuecomment-475723897&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9f49bc07bd094727611708d6aef150c0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888748808737645&sdata=ga6%2BGoGN7hssVyiuC6L1VeCSrUsoMPJn%2FzyzOuFI4oc%3D&reserved=0, or mute the threadhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAeRjbWf_7APTLwDR1JU3rI3QkDszlaSBks5vZRv8gaJpZM4bi5hl&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9f49bc07bd094727611708d6aef150c0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888748808747637&sdata=6Zcqv1Ei6TJw3a2OEskcurnoGlem%2B3GGALANnohzbzY%3D&reserved=0.

mattyweb commented 5 years ago

Sure. It's in a private GitHub repo though. What's your handle?

On Fri, Mar 22, 2019 at 12:06 PM Patrick notifications@github.com wrote:

Can you share the rest of the code on GitHub?

Get Outlook for Androidhttps://aka.ms/ghei36


From: Matt Webster notifications@github.com Sent: Friday, March 22, 2019 11:07:56 AM To: MicrosoftDocs/azure-docs Cc: Patrick Lee; Comment Subject: Re: [MicrosoftDocs/azure-docs] SSH instructions for webapps using docker container are incorrect (#26454)

I should add that when running in the Azure Pipeline those echo lines show the PWD as /usr/src/app as expected but the azure_startup directory doesn't seem to be there.

Also, I am also starting the container locally with "docker run -p 4000:2222 -p 4004:3001 dayaxe-web" but obviously haven't gotten to that point in Azure as builds aren't working yet.

On Fri, Mar 22, 2019 at 10:59 AM Matt Webster mattyweb@gmail.com wrote:

Hi Patrick,

Still working on this. Currently, I have everything working fine locally and am able to build and run the image and SSH to it on my machine.

However, the build is failing in Azure. The issue I'm running into now is trying to overwrite the sshd_config file on the image. I've tried several combinations of COPY and RUN cp or RUN mv, tried starting with the sshd_config in the root versus the azure_startup directory, tried renaming the azure_startup directory (in case that was some kind of a keyword) all without success. Whatever I try ends up with some form of "COPY failed: stat ... sshd_config: no such file or directory"

Any more ideas? Given that SSH is working locally I'm thinking there may be some nuance to the Azure docker environment that I'm missing...

The full Dockerfile is here:

using the official LTS node image. might try slimmer version at some

point. FROM node:10.15

set working directory and copy over files

WORKDIR /usr/src/app COPY . .

setting environment variables up for Azure staging environment (will

use production for all Azure sites) ENV NODE_ENV=production ENV PORT=3001 ENV OPENWEATHER_APIKEY=ccf112262d9e4f0ba12c3cb05a8ba71b ENV ACCUWEATHER_APIKEY=d41dfd5e8a1748d0970cba6637647d96 ENV API_URL=https://dayaxe-web-stage.azurewebsites.net/api/v1/ ENV API_DOMAIN=https://dayaxe-web-stage.azurewebsites.net/ ENV CDN_URL=https://cdn.dayaxe.com

set up OpenSSL and ports for SSH

ENV SSH_PASSWD "root:Docker!" RUN apt-get update \ && apt-get install -y --no-install-recommends dialog \ && apt-get update \ && apt-get install -y --no-install-recommends openssh-server \ && echo "$SSH_PASSWD" | chpasswd

RUN rm -f /etc/ssh/sshd_config RUN echo $PWD RUN echo $(ls -al azure_startup) COPY azure_startup/sshd_config /etc/ssh/ ENV SSH_PORT 2222 RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config RUN chmod 755 azure_startup/docker_init.sh ENV PATH ${PATH}:azure_startup

expose some ports for access from web and azure kudu (SCM) container

EXPOSE 2222 EXPOSE 3001

install and start the project

RUN npm i -g yarn RUN yarn install --prod RUN yarn build

ENTRYPOINT ["azure_startup/docker_init.sh"]

On Thu, Mar 21, 2019 at 6:43 PM Patrick notifications@github.com wrote:

Docker files don't start the start of running processes. So RUN service ssh start won't work. You need an init script to start ssh and yarn.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Matt Webster notifications@github.com Sent: Thursday, March 21, 2019 6:25:29 PM To: MicrosoftDocs/azure-docs Cc: Patrick Lee; Comment Subject: Re: [MicrosoftDocs/azure-docs] SSH instructions for webapps using docker container are incorrect (#26454)

Hi Patrick,

I'm still beating my head against the wall here. The builds and deploys look like they are working but I'm still getting the same error. I'm also still not able to use the webssh portal to connect to my image.

It's likely my script has something wrong with it. I'm not using PM2 so trying to extract the key bits from those examples. Also, I'm not super comfortable with bash scripts and would like to avoid doing too many of these.

My Dockerfile now looks like this:

using the official LTS node image. might try slimmer version at some

point. FROM node:10.15

set working directory and copy over files

WORKDIR /usr/src/app COPY . .

setting environment variables up for Azure staging environment (will

use production for all Azure sites) ENV NODE_ENV=production ENV PORT=443 ENV OPENWEATHER_APIKEY=ccf112262d9e4f0ba12c3cb05a8ba71b ENV ACCUWEATHER_APIKEY=d41dfd5e8a1748d0970cba6637647d96 ENV API_URL=https://dayaxe-web-stage.azurewebsites.net/api/v1/ ENV API_DOMAIN=https://dayaxe-web-stage.azurewebsites.net/ ENV CDN_URL=https://cdn.dayaxe.com

set up OpenSSL and ports for SSH

ENV SSH_PASSWD "root:Docker!" RUN apt-get update \ && apt-get install -y --no-install-recommends dialog \ && apt-get update \ && apt-get install -y --no-install-recommends openssh-server \ && echo "$SSH_PASSWD" | chpasswd

RUN rm -f /etc/ssh/sshd_config COPY sshd_config /etc/ssh/ ENV SSH_PORT 2222 RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config RUN service ssh start EXPOSE 2222

expose some ports for access from web and azure kudu (SCM) container

EXPOSE 443

install and start the project

RUN npm i -g yarn RUN yarn install --prod RUN yarn build

CMD [ "yarn", "start" ]

Here is the relevant part of the build log. Nothing is jumping out at me here, but I'm not sure what I should be looking for.

Step 11/33 : ENV SSH_PASSWD "root:Docker!" ---> Running in c89d35497a3c Removing intermediate container c89d35497a3c ---> 5e4452b269dc Step 12/33 : RUN apt-get update && apt-get install -y --no-install-recommends dialog && apt-get update && apt-get install -y --no-install-recommends openssh-server && echo "$SSH_PASSWD" | chpasswd ---> Running in 86a36cf4e04f Ign:1 http://deb.debian.org/debian stretch InRelease Get:2 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB] Get:3 http://deb.debian.org/debian stretch Release [118 kB] Get:4 http://deb.debian.org/debian stretch Release.gpg [2434 B] Get:5 http://deb.debian.org/debian stretch-updates/main amd64 Packages [11.1 kB] Get:6 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB] Get:7 http://deb.debian.org/debian stretch/main amd64 Packages [7084 kB] Get:8 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [480 kB] Fetched 7880 kB in 1s (5364 kB/s) Reading package lists... Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: dialog 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 262 kB of archives. After this operation, 1138 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian stretch/main amd64 dialog amd64 1.3-20160828-2 [262 kB] debconf: delaying package configuration, since apt-utils is not installedFetched 262 kB in 0s (8832 kB/s)‌ Selecting previously unselected package dialog. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 29978 files and directories currently installed.) Preparing to unpack .../dialog_1.3-20160828-2_amd64.deb ... Unpacking dialog (1.3-20160828-2) ... Setting up dialog (1.3-20160828-2) ... Hit:1 http://security.debian.org/debian-security stretch/updates InRelease Ign:2 http://deb.debian.org/debian stretch InRelease Hit:3 http://deb.debian.org/debian stretch-updates InRelease Hit:4 http://deb.debian.org/debian stretch Release Reading package lists... Reading package lists... Building dependency tree... Reading state information... The following additional packages will be installed: libwrap0 openssh-sftp-server Suggested packages: molly-guard monkeysphere rssh ssh-askpass ufw Recommended packages: tcpd libpam-systemd ncurses-term xauth The following NEW packages will be installed: libwrap0 openssh-server openssh-sftp-server 0 upgraded, 3 newly installed, 0 to remove and 2 not upgraded. Need to get 430 kB of archives. After this operation, 1119 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian stretch/main amd64 libwrap0 amd64 7.6.q-26 [58.2 kB] Get:2 http://security.debian.org/debian-security stretch/updates/main amd64 openssh-sftp-server amd64 1:7.4p1-10+deb9u6 [39.7 kB] Get:3 http://security.debian.org/debian-security stretch/updates/main amd64 openssh-server amd64 1:7.4p1-10+deb9u6 [332 kB] debconf: delaying package configuration, since apt-utils is not installedFetched 430 kB in 0s (19.0 MB/s)‌ Selecting previously unselected package libwrap0:amd64. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 30132 files and directories currently installed.) Preparing to unpack .../libwrap0_7.6.q-26_amd64.deb ... Unpacking libwrap0:amd64 (7.6.q-26) ... Selecting previously unselected package openssh-sftp-server. Preparing to unpack .../openssh-sftp-server_1%3a7.4p1-10+deb9u6_amd64.deb ... Unpacking openssh-sftp-server (1:7.4p1-10+deb9u6) ... Selecting previously unselected package openssh-server. Preparing to unpack .../openssh-server_1%3a7.4p1-10+deb9u6_amd64.deb ... Unpacking openssh-server (1:7.4p1-10+deb9u6) ... Setting up openssh-sftp-server (1:7.4p1-10+deb9u6) ... Processing triggers for libc-bin (2.24-11+deb9u4) ... Setting up libwrap0:amd64 (7.6.q-26) ... Setting up openssh-server (1:7.4p1-10+deb9u6) ... debconf: unable to initialize frontend: Dialog debconf: (TERM is not set, so the dialog frontend is not usable.) debconf: falling back to frontend: Readline

Creating config file /etc/ssh/sshd_config with new version Creating SSH2 RSA key; this may take some time ... 2048 SHA256:s5x/tFiaSyeij/e9mx6EKSClr5rd2cqu4FcxtGT9LP4 root@86a36cf4e04f (RSA) Creating SSH2 ECDSA key; this may take some time ... 256 SHA256:syiIWD5nialzaKzIW05C5b4ZWjaq97760W++tM0lzLQ root@86a36cf4e04f (ECDSA) Creating SSH2 ED25519 key; this may take some time ... 256 SHA256:CnIVQy7E87c5Cu1T5H+F3WtqeO/ciOeiBQoDnknEyfA root@86a36cf4e04f (ED25519) invoke-rc.d: could not determine current runlevel invoke-rc.d: policy-rc.d denied execution of start. Processing triggers for libc-bin (2.24-11+deb9u4) ... Removing intermediate container 86a36cf4e04f ---> e46d47d633d3 Step 13/33 : RUN rm -f /etc/ssh/sshd_config ---> Running in e2c346714a10 Removing intermediate container e2c346714a10 ---> 4fddc2236c33 Step 14/33 : COPY sshd_config /etc/ssh/ ---> c0f09eadf98f Step 15/33 : ENV SSH_PORT 2222 ---> Running in e3bb2a4dcd47 Removing intermediate container e3bb2a4dcd47 ---> b9b5bb428816 Step 16/33 : RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config ---> Running in aa82a7e65c44 Removing intermediate container aa82a7e65c44 ---> c32be86f34f4 Step 17/33 : RUN service ssh start ---> Running in ea87ce51c7b1 Starting OpenBSD Secure Shell server: sshd. Removing intermediate container ea87ce51c7b1 ---> 7ee5e9d3cfe3 Step 18/33 : EXPOSE 2222 ---> Running in 30f044df82d2

On Thu, Mar 21, 2019 at 4:20 PM Patrick notifications@github.com wrote:

CMD [ "yarn", "start" ], you still need to start the ssh service the blessed image uses init_container.sh as an entrypoint to accomplish this

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475439298

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AJui8O3najS1tjehXZEdQsZ9c8rDHQaMks5vZBPPgaJpZM4bi5hl

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub<

https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftDocs%2Fazure-docs%2Fissues%2F26454%23issuecomment-475461631&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9a446f3216b941d4fbd108d6ae654544%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888147322181384&sdata=alSSigi1DjY4TEmxW%2BfuAWWgmiX1rb4u3BP%2FIRIkBKE%3D&reserved=0 , or mute the thread<

https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAeRjbZnSCMI8K8z2kVoxExKQhK4vvXceks5vZDEJgaJpZM4bi5hl&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9a446f3216b941d4fbd108d6ae654544%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888147322191378&sdata=hUQYnESbVVav0hP4%2BYB6Q5rv9P0858d6dsRFBwE8hsc%3D&reserved=0

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475464703 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AJui8K0n0341zGGTvSHvor643NLpjG3tks5vZDU6gaJpZM4bi5hl

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub< https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftDocs%2Fazure-docs%2Fissues%2F26454%23issuecomment-475723897&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9f49bc07bd094727611708d6aef150c0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888748808737645&sdata=ga6%2BGoGN7hssVyiuC6L1VeCSrUsoMPJn%2FzyzOuFI4oc%3D&reserved=0>, or mute the thread< https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAeRjbWf_7APTLwDR1JU3rI3QkDszlaSBks5vZRv8gaJpZM4bi5hl&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9f49bc07bd094727611708d6aef150c0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888748808747637&sdata=6Zcqv1Ei6TJw3a2OEskcurnoGlem%2B3GGALANnohzbzY%3D&reserved=0

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475744608, or mute the thread https://github.com/notifications/unsubscribe-auth/AJui8ER-z5a8hfkJdSiTGHzkT5cpAvWyks5vZSnLgaJpZM4bi5hl .

patricklee2 commented 5 years ago

patricklee2

Get Outlook for Androidhttps://aka.ms/ghei36


From: Matt Webster notifications@github.com Sent: Friday, March 22, 2019 12:14:18 PM To: MicrosoftDocs/azure-docs Cc: Patrick Lee; Comment Subject: Re: [MicrosoftDocs/azure-docs] SSH instructions for webapps using docker container are incorrect (#26454)

Sure. It's in a private GitHub repo though. What's your handle?

On Fri, Mar 22, 2019 at 12:06 PM Patrick notifications@github.com wrote:

Can you share the rest of the code on GitHub?

Get Outlook for Androidhttps://aka.ms/ghei36


From: Matt Webster notifications@github.com Sent: Friday, March 22, 2019 11:07:56 AM To: MicrosoftDocs/azure-docs Cc: Patrick Lee; Comment Subject: Re: [MicrosoftDocs/azure-docs] SSH instructions for webapps using docker container are incorrect (#26454)

I should add that when running in the Azure Pipeline those echo lines show the PWD as /usr/src/app as expected but the azure_startup directory doesn't seem to be there.

Also, I am also starting the container locally with "docker run -p 4000:2222 -p 4004:3001 dayaxe-web" but obviously haven't gotten to that point in Azure as builds aren't working yet.

On Fri, Mar 22, 2019 at 10:59 AM Matt Webster mattyweb@gmail.com wrote:

Hi Patrick,

Still working on this. Currently, I have everything working fine locally and am able to build and run the image and SSH to it on my machine.

However, the build is failing in Azure. The issue I'm running into now is trying to overwrite the sshd_config file on the image. I've tried several combinations of COPY and RUN cp or RUN mv, tried starting with the sshd_config in the root versus the azure_startup directory, tried renaming the azure_startup directory (in case that was some kind of a keyword) all without success. Whatever I try ends up with some form of "COPY failed: stat ... sshd_config: no such file or directory"

Any more ideas? Given that SSH is working locally I'm thinking there may be some nuance to the Azure docker environment that I'm missing...

The full Dockerfile is here:

using the official LTS node image. might try slimmer version at some

point. FROM node:10.15

set working directory and copy over files

WORKDIR /usr/src/app COPY . .

setting environment variables up for Azure staging environment (will

use production for all Azure sites) ENV NODE_ENV=production ENV PORT=3001 ENV OPENWEATHER_APIKEY=ccf112262d9e4f0ba12c3cb05a8ba71b ENV ACCUWEATHER_APIKEY=d41dfd5e8a1748d0970cba6637647d96 ENV API_URL=https://dayaxe-web-stage.azurewebsites.net/api/v1/ ENV API_DOMAIN=https://dayaxe-web-stage.azurewebsites.net/ ENV CDN_URL=https://cdn.dayaxe.com

set up OpenSSL and ports for SSH

ENV SSH_PASSWD "root:Docker!" RUN apt-get update \ && apt-get install -y --no-install-recommends dialog \ && apt-get update \ && apt-get install -y --no-install-recommends openssh-server \ && echo "$SSH_PASSWD" | chpasswd

RUN rm -f /etc/ssh/sshd_config RUN echo $PWD RUN echo $(ls -al azure_startup) COPY azure_startup/sshd_config /etc/ssh/ ENV SSH_PORT 2222 RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config RUN chmod 755 azure_startup/docker_init.sh ENV PATH ${PATH}:azure_startup

expose some ports for access from web and azure kudu (SCM) container

EXPOSE 2222 EXPOSE 3001

install and start the project

RUN npm i -g yarn RUN yarn install --prod RUN yarn build

ENTRYPOINT ["azure_startup/docker_init.sh"]

On Thu, Mar 21, 2019 at 6:43 PM Patrick notifications@github.com wrote:

Docker files don't start the start of running processes. So RUN service ssh start won't work. You need an init script to start ssh and yarn.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Matt Webster notifications@github.com Sent: Thursday, March 21, 2019 6:25:29 PM To: MicrosoftDocs/azure-docs Cc: Patrick Lee; Comment Subject: Re: [MicrosoftDocs/azure-docs] SSH instructions for webapps using docker container are incorrect (#26454)

Hi Patrick,

I'm still beating my head against the wall here. The builds and deploys look like they are working but I'm still getting the same error. I'm also still not able to use the webssh portal to connect to my image.

It's likely my script has something wrong with it. I'm not using PM2 so trying to extract the key bits from those examples. Also, I'm not super comfortable with bash scripts and would like to avoid doing too many of these.

My Dockerfile now looks like this:

using the official LTS node image. might try slimmer version at some

point. FROM node:10.15

set working directory and copy over files

WORKDIR /usr/src/app COPY . .

setting environment variables up for Azure staging environment (will

use production for all Azure sites) ENV NODE_ENV=production ENV PORT=443 ENV OPENWEATHER_APIKEY=ccf112262d9e4f0ba12c3cb05a8ba71b ENV ACCUWEATHER_APIKEY=d41dfd5e8a1748d0970cba6637647d96 ENV API_URL=https://dayaxe-web-stage.azurewebsites.net/api/v1/ ENV API_DOMAIN=https://dayaxe-web-stage.azurewebsites.net/ ENV CDN_URL=https://cdn.dayaxe.com

set up OpenSSL and ports for SSH

ENV SSH_PASSWD "root:Docker!" RUN apt-get update \ && apt-get install -y --no-install-recommends dialog \ && apt-get update \ && apt-get install -y --no-install-recommends openssh-server \ && echo "$SSH_PASSWD" | chpasswd

RUN rm -f /etc/ssh/sshd_config COPY sshd_config /etc/ssh/ ENV SSH_PORT 2222 RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config RUN service ssh start EXPOSE 2222

expose some ports for access from web and azure kudu (SCM) container

EXPOSE 443

install and start the project

RUN npm i -g yarn RUN yarn install --prod RUN yarn build

CMD [ "yarn", "start" ]

Here is the relevant part of the build log. Nothing is jumping out at me here, but I'm not sure what I should be looking for.

Step 11/33 : ENV SSH_PASSWD "root:Docker!" ---> Running in c89d35497a3c Removing intermediate container c89d35497a3c ---> 5e4452b269dc Step 12/33 : RUN apt-get update && apt-get install -y --no-install-recommends dialog && apt-get update && apt-get install -y --no-install-recommends openssh-server && echo "$SSH_PASSWD" | chpasswd ---> Running in 86a36cf4e04f Ign:1 http://deb.debian.org/debian stretch InRelease Get:2 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB] Get:3 http://deb.debian.org/debian stretch Release [118 kB] Get:4 http://deb.debian.org/debian stretch Release.gpg [2434 B] Get:5 http://deb.debian.org/debian stretch-updates/main amd64 Packages [11.1 kB] Get:6 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB] Get:7 http://deb.debian.org/debian stretch/main amd64 Packages [7084 kB] Get:8 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [480 kB] Fetched 7880 kB in 1s (5364 kB/s) Reading package lists... Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: dialog 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 262 kB of archives. After this operation, 1138 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian stretch/main amd64 dialog amd64 1.3-20160828-2 [262 kB] debconf: delaying package configuration, since apt-utils is not installedFetched 262 kB in 0s (8832 kB/s)‌ Selecting previously unselected package dialog. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 29978 files and directories currently installed.) Preparing to unpack .../dialog_1.3-20160828-2_amd64.deb ... Unpacking dialog (1.3-20160828-2) ... Setting up dialog (1.3-20160828-2) ... Hit:1 http://security.debian.org/debian-security stretch/updates InRelease Ign:2 http://deb.debian.org/debian stretch InRelease Hit:3 http://deb.debian.org/debian stretch-updates InRelease Hit:4 http://deb.debian.org/debian stretch Release Reading package lists... Reading package lists... Building dependency tree... Reading state information... The following additional packages will be installed: libwrap0 openssh-sftp-server Suggested packages: molly-guard monkeysphere rssh ssh-askpass ufw Recommended packages: tcpd libpam-systemd ncurses-term xauth The following NEW packages will be installed: libwrap0 openssh-server openssh-sftp-server 0 upgraded, 3 newly installed, 0 to remove and 2 not upgraded. Need to get 430 kB of archives. After this operation, 1119 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian stretch/main amd64 libwrap0 amd64 7.6.q-26 [58.2 kB] Get:2 http://security.debian.org/debian-security stretch/updates/main amd64 openssh-sftp-server amd64 1:7.4p1-10+deb9u6 [39.7 kB] Get:3 http://security.debian.org/debian-security stretch/updates/main amd64 openssh-server amd64 1:7.4p1-10+deb9u6 [332 kB] debconf: delaying package configuration, since apt-utils is not installedFetched 430 kB in 0s (19.0 MB/s)‌ Selecting previously unselected package libwrap0:amd64. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 30132 files and directories currently installed.) Preparing to unpack .../libwrap0_7.6.q-26_amd64.deb ... Unpacking libwrap0:amd64 (7.6.q-26) ... Selecting previously unselected package openssh-sftp-server. Preparing to unpack .../openssh-sftp-server_1%3a7.4p1-10+deb9u6_amd64.deb ... Unpacking openssh-sftp-server (1:7.4p1-10+deb9u6) ... Selecting previously unselected package openssh-server. Preparing to unpack .../openssh-server_1%3a7.4p1-10+deb9u6_amd64.deb ... Unpacking openssh-server (1:7.4p1-10+deb9u6) ... Setting up openssh-sftp-server (1:7.4p1-10+deb9u6) ... Processing triggers for libc-bin (2.24-11+deb9u4) ... Setting up libwrap0:amd64 (7.6.q-26) ... Setting up openssh-server (1:7.4p1-10+deb9u6) ... debconf: unable to initialize frontend: Dialog debconf: (TERM is not set, so the dialog frontend is not usable.) debconf: falling back to frontend: Readline

Creating config file /etc/ssh/sshd_config with new version Creating SSH2 RSA key; this may take some time ... 2048 SHA256:s5x/tFiaSyeij/e9mx6EKSClr5rd2cqu4FcxtGT9LP4 root@86a36cf4e04f (RSA) Creating SSH2 ECDSA key; this may take some time ... 256 SHA256:syiIWD5nialzaKzIW05C5b4ZWjaq97760W++tM0lzLQ root@86a36cf4e04f (ECDSA) Creating SSH2 ED25519 key; this may take some time ... 256 SHA256:CnIVQy7E87c5Cu1T5H+F3WtqeO/ciOeiBQoDnknEyfA root@86a36cf4e04f (ED25519) invoke-rc.d: could not determine current runlevel invoke-rc.d: policy-rc.d denied execution of start. Processing triggers for libc-bin (2.24-11+deb9u4) ... Removing intermediate container 86a36cf4e04f ---> e46d47d633d3 Step 13/33 : RUN rm -f /etc/ssh/sshd_config ---> Running in e2c346714a10 Removing intermediate container e2c346714a10 ---> 4fddc2236c33 Step 14/33 : COPY sshd_config /etc/ssh/ ---> c0f09eadf98f Step 15/33 : ENV SSH_PORT 2222 ---> Running in e3bb2a4dcd47 Removing intermediate container e3bb2a4dcd47 ---> b9b5bb428816 Step 16/33 : RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config ---> Running in aa82a7e65c44 Removing intermediate container aa82a7e65c44 ---> c32be86f34f4 Step 17/33 : RUN service ssh start ---> Running in ea87ce51c7b1 Starting OpenBSD Secure Shell server: sshd. Removing intermediate container ea87ce51c7b1 ---> 7ee5e9d3cfe3 Step 18/33 : EXPOSE 2222 ---> Running in 30f044df82d2

On Thu, Mar 21, 2019 at 4:20 PM Patrick notifications@github.com wrote:

CMD [ "yarn", "start" ], you still need to start the ssh service the blessed image uses init_container.sh as an entrypoint to accomplish this

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475439298

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AJui8O3najS1tjehXZEdQsZ9c8rDHQaMks5vZBPPgaJpZM4bi5hl

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub<

https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftDocs%2Fazure-docs%2Fissues%2F26454%23issuecomment-475461631&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9a446f3216b941d4fbd108d6ae654544%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888147322181384&sdata=alSSigi1DjY4TEmxW%2BfuAWWgmiX1rb4u3BP%2FIRIkBKE%3D&reserved=0 , or mute the thread<

https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAeRjbZnSCMI8K8z2kVoxExKQhK4vvXceks5vZDEJgaJpZM4bi5hl&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9a446f3216b941d4fbd108d6ae654544%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888147322191378&sdata=hUQYnESbVVav0hP4%2BYB6Q5rv9P0858d6dsRFBwE8hsc%3D&reserved=0

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475464703 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AJui8K0n0341zGGTvSHvor643NLpjG3tks5vZDU6gaJpZM4bi5hl

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub< https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftDocs%2Fazure-docs%2Fissues%2F26454%23issuecomment-475723897&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9f49bc07bd094727611708d6aef150c0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888748808737645&sdata=ga6%2BGoGN7hssVyiuC6L1VeCSrUsoMPJn%2FzyzOuFI4oc%3D&reserved=0>, or mute the thread< https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAeRjbWf_7APTLwDR1JU3rI3QkDszlaSBks5vZRv8gaJpZM4bi5hl&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9f49bc07bd094727611708d6aef150c0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888748808747637&sdata=6Zcqv1Ei6TJw3a2OEskcurnoGlem%2B3GGALANnohzbzY%3D&reserved=0

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475744608, or mute the thread https://github.com/notifications/unsubscribe-auth/AJui8ER-z5a8hfkJdSiTGHzkT5cpAvWyks5vZSnLgaJpZM4bi5hl .

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftDocs%2Fazure-docs%2Fissues%2F26454%23issuecomment-475746973&data=02%7C01%7Cpatrick.lee%40microsoft.com%7Ca3f4b508150b4006178808d6aefa960d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888788623387250&sdata=uIGPjJEcZnLDSETvFnYOmgHNaG17UncDpJwq2OJ8iH4%3D&reserved=0, or mute the threadhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAeRjbfBU20AQIFoFLYIVXjU4ddNYfclbks5vZSuJgaJpZM4bi5hl&data=02%7C01%7Cpatrick.lee%40microsoft.com%7Ca3f4b508150b4006178808d6aefa960d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888788623397248&sdata=T86PZhlzKcRWe%2FvImtoyjL%2BEOGP2uJ2tGCCFPINbHPY%3D&reserved=0.

mattyweb commented 5 years ago

Got it. Here's the link: https://github.com/dayaxe/dayaxe-web/invitations

On Fri, Mar 22, 2019 at 12:29 PM Patrick notifications@github.com wrote:

patricklee2

Get Outlook for Androidhttps://aka.ms/ghei36


From: Matt Webster notifications@github.com Sent: Friday, March 22, 2019 12:14:18 PM To: MicrosoftDocs/azure-docs Cc: Patrick Lee; Comment Subject: Re: [MicrosoftDocs/azure-docs] SSH instructions for webapps using docker container are incorrect (#26454)

Sure. It's in a private GitHub repo though. What's your handle?

On Fri, Mar 22, 2019 at 12:06 PM Patrick notifications@github.com wrote:

Can you share the rest of the code on GitHub?

Get Outlook for Androidhttps://aka.ms/ghei36


From: Matt Webster notifications@github.com Sent: Friday, March 22, 2019 11:07:56 AM To: MicrosoftDocs/azure-docs Cc: Patrick Lee; Comment Subject: Re: [MicrosoftDocs/azure-docs] SSH instructions for webapps using docker container are incorrect (#26454)

I should add that when running in the Azure Pipeline those echo lines show the PWD as /usr/src/app as expected but the azure_startup directory doesn't seem to be there.

Also, I am also starting the container locally with "docker run -p 4000:2222 -p 4004:3001 dayaxe-web" but obviously haven't gotten to that point in Azure as builds aren't working yet.

On Fri, Mar 22, 2019 at 10:59 AM Matt Webster mattyweb@gmail.com wrote:

Hi Patrick,

Still working on this. Currently, I have everything working fine locally and am able to build and run the image and SSH to it on my machine.

However, the build is failing in Azure. The issue I'm running into now is trying to overwrite the sshd_config file on the image. I've tried several combinations of COPY and RUN cp or RUN mv, tried starting with the sshd_config in the root versus the azure_startup directory, tried renaming the azure_startup directory (in case that was some kind of a keyword) all without success. Whatever I try ends up with some form of "COPY failed: stat ... sshd_config: no such file or directory"

Any more ideas? Given that SSH is working locally I'm thinking there may be some nuance to the Azure docker environment that I'm missing...

The full Dockerfile is here:

using the official LTS node image. might try slimmer version at some

point. FROM node:10.15

set working directory and copy over files

WORKDIR /usr/src/app COPY . .

setting environment variables up for Azure staging environment (will

use production for all Azure sites) ENV NODE_ENV=production ENV PORT=3001 ENV OPENWEATHER_APIKEY=ccf112262d9e4f0ba12c3cb05a8ba71b ENV ACCUWEATHER_APIKEY=d41dfd5e8a1748d0970cba6637647d96 ENV API_URL=https://dayaxe-web-stage.azurewebsites.net/api/v1/ ENV API_DOMAIN=https://dayaxe-web-stage.azurewebsites.net/ ENV CDN_URL=https://cdn.dayaxe.com

set up OpenSSL and ports for SSH

ENV SSH_PASSWD "root:Docker!" RUN apt-get update \ && apt-get install -y --no-install-recommends dialog \ && apt-get update \ && apt-get install -y --no-install-recommends openssh-server \ && echo "$SSH_PASSWD" | chpasswd

RUN rm -f /etc/ssh/sshd_config RUN echo $PWD RUN echo $(ls -al azure_startup) COPY azure_startup/sshd_config /etc/ssh/ ENV SSH_PORT 2222 RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config RUN chmod 755 azure_startup/docker_init.sh ENV PATH ${PATH}:azure_startup

expose some ports for access from web and azure kudu (SCM) container

EXPOSE 2222 EXPOSE 3001

install and start the project

RUN npm i -g yarn RUN yarn install --prod RUN yarn build

ENTRYPOINT ["azure_startup/docker_init.sh"]

On Thu, Mar 21, 2019 at 6:43 PM Patrick notifications@github.com wrote:

Docker files don't start the start of running processes. So RUN service ssh start won't work. You need an init script to start ssh and yarn.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Matt Webster notifications@github.com Sent: Thursday, March 21, 2019 6:25:29 PM To: MicrosoftDocs/azure-docs Cc: Patrick Lee; Comment Subject: Re: [MicrosoftDocs/azure-docs] SSH instructions for webapps using docker container are incorrect (#26454)

Hi Patrick,

I'm still beating my head against the wall here. The builds and deploys look like they are working but I'm still getting the same error. I'm also still not able to use the webssh portal to connect to my image.

It's likely my script has something wrong with it. I'm not using PM2 so trying to extract the key bits from those examples. Also, I'm not super comfortable with bash scripts and would like to avoid doing too many of these.

My Dockerfile now looks like this:

using the official LTS node image. might try slimmer version at some

point. FROM node:10.15

set working directory and copy over files

WORKDIR /usr/src/app COPY . .

setting environment variables up for Azure staging environment (will

use production for all Azure sites) ENV NODE_ENV=production ENV PORT=443 ENV OPENWEATHER_APIKEY=ccf112262d9e4f0ba12c3cb05a8ba71b ENV ACCUWEATHER_APIKEY=d41dfd5e8a1748d0970cba6637647d96 ENV API_URL=https://dayaxe-web-stage.azurewebsites.net/api/v1/ ENV API_DOMAIN=https://dayaxe-web-stage.azurewebsites.net/ ENV CDN_URL=https://cdn.dayaxe.com

set up OpenSSL and ports for SSH

ENV SSH_PASSWD "root:Docker!" RUN apt-get update \ && apt-get install -y --no-install-recommends dialog \ && apt-get update \ && apt-get install -y --no-install-recommends openssh-server \ && echo "$SSH_PASSWD" | chpasswd

RUN rm -f /etc/ssh/sshd_config COPY sshd_config /etc/ssh/ ENV SSH_PORT 2222 RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config RUN service ssh start EXPOSE 2222

expose some ports for access from web and azure kudu (SCM) container

EXPOSE 443

install and start the project

RUN npm i -g yarn RUN yarn install --prod RUN yarn build

CMD [ "yarn", "start" ]

Here is the relevant part of the build log. Nothing is jumping out at me here, but I'm not sure what I should be looking for.

Step 11/33 : ENV SSH_PASSWD "root:Docker!" ---> Running in c89d35497a3c Removing intermediate container c89d35497a3c ---> 5e4452b269dc Step 12/33 : RUN apt-get update && apt-get install -y --no-install-recommends dialog && apt-get update && apt-get install -y --no-install-recommends openssh-server && echo "$SSH_PASSWD" | chpasswd ---> Running in 86a36cf4e04f Ign:1 http://deb.debian.org/debian stretch InRelease Get:2 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB] Get:3 http://deb.debian.org/debian stretch Release [118 kB] Get:4 http://deb.debian.org/debian stretch Release.gpg [2434 B] Get:5 http://deb.debian.org/debian stretch-updates/main amd64 Packages [11.1 kB] Get:6 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB] Get:7 http://deb.debian.org/debian stretch/main amd64 Packages [7084 kB] Get:8 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [480 kB] Fetched 7880 kB in 1s (5364 kB/s) Reading package lists... Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: dialog 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 262 kB of archives. After this operation, 1138 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian stretch/main amd64 dialog amd64 1.3-20160828-2 [262 kB] debconf: delaying package configuration, since apt-utils is not installedFetched 262 kB in 0s (8832 kB/s)‌ Selecting previously unselected package dialog. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 29978 files and directories currently installed.) Preparing to unpack .../dialog_1.3-20160828-2_amd64.deb ... Unpacking dialog (1.3-20160828-2) ... Setting up dialog (1.3-20160828-2) ... Hit:1 http://security.debian.org/debian-security stretch/updates InRelease Ign:2 http://deb.debian.org/debian stretch InRelease Hit:3 http://deb.debian.org/debian stretch-updates InRelease Hit:4 http://deb.debian.org/debian stretch Release Reading package lists... Reading package lists... Building dependency tree... Reading state information... The following additional packages will be installed: libwrap0 openssh-sftp-server Suggested packages: molly-guard monkeysphere rssh ssh-askpass ufw Recommended packages: tcpd libpam-systemd ncurses-term xauth The following NEW packages will be installed: libwrap0 openssh-server openssh-sftp-server 0 upgraded, 3 newly installed, 0 to remove and 2 not upgraded. Need to get 430 kB of archives. After this operation, 1119 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian stretch/main amd64 libwrap0 amd64 7.6.q-26 [58.2 kB] Get:2 http://security.debian.org/debian-security stretch/updates/main amd64 openssh-sftp-server amd64 1:7.4p1-10+deb9u6 [39.7 kB] Get:3 http://security.debian.org/debian-security stretch/updates/main amd64 openssh-server amd64 1:7.4p1-10+deb9u6 [332 kB] debconf: delaying package configuration, since apt-utils is not installedFetched 430 kB in 0s (19.0 MB/s)‌ Selecting previously unselected package libwrap0:amd64. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 30132 files and directories currently installed.) Preparing to unpack .../libwrap0_7.6.q-26_amd64.deb ... Unpacking libwrap0:amd64 (7.6.q-26) ... Selecting previously unselected package openssh-sftp-server. Preparing to unpack .../openssh-sftp-server_1%3a7.4p1-10+deb9u6_amd64.deb ... Unpacking openssh-sftp-server (1:7.4p1-10+deb9u6) ... Selecting previously unselected package openssh-server. Preparing to unpack .../openssh-server_1%3a7.4p1-10+deb9u6_amd64.deb ... Unpacking openssh-server (1:7.4p1-10+deb9u6) ... Setting up openssh-sftp-server (1:7.4p1-10+deb9u6) ... Processing triggers for libc-bin (2.24-11+deb9u4) ... Setting up libwrap0:amd64 (7.6.q-26) ... Setting up openssh-server (1:7.4p1-10+deb9u6) ... debconf: unable to initialize frontend: Dialog debconf: (TERM is not set, so the dialog frontend is not usable.) debconf: falling back to frontend: Readline

Creating config file /etc/ssh/sshd_config with new version Creating SSH2 RSA key; this may take some time ... 2048 SHA256:s5x/tFiaSyeij/e9mx6EKSClr5rd2cqu4FcxtGT9LP4 root@86a36cf4e04f (RSA) Creating SSH2 ECDSA key; this may take some time ... 256 SHA256:syiIWD5nialzaKzIW05C5b4ZWjaq97760W++tM0lzLQ root@86a36cf4e04f (ECDSA) Creating SSH2 ED25519 key; this may take some time ... 256 SHA256:CnIVQy7E87c5Cu1T5H+F3WtqeO/ciOeiBQoDnknEyfA root@86a36cf4e04f (ED25519) invoke-rc.d: could not determine current runlevel invoke-rc.d: policy-rc.d denied execution of start. Processing triggers for libc-bin (2.24-11+deb9u4) ... Removing intermediate container 86a36cf4e04f ---> e46d47d633d3 Step 13/33 : RUN rm -f /etc/ssh/sshd_config ---> Running in e2c346714a10 Removing intermediate container e2c346714a10 ---> 4fddc2236c33 Step 14/33 : COPY sshd_config /etc/ssh/ ---> c0f09eadf98f Step 15/33 : ENV SSH_PORT 2222 ---> Running in e3bb2a4dcd47 Removing intermediate container e3bb2a4dcd47 ---> b9b5bb428816 Step 16/33 : RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config ---> Running in aa82a7e65c44 Removing intermediate container aa82a7e65c44 ---> c32be86f34f4 Step 17/33 : RUN service ssh start ---> Running in ea87ce51c7b1 Starting OpenBSD Secure Shell server: sshd. Removing intermediate container ea87ce51c7b1 ---> 7ee5e9d3cfe3 Step 18/33 : EXPOSE 2222 ---> Running in 30f044df82d2

On Thu, Mar 21, 2019 at 4:20 PM Patrick notifications@github.com wrote:

CMD [ "yarn", "start" ], you still need to start the ssh service the blessed image uses init_container.sh as an entrypoint to accomplish this

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475439298

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AJui8O3najS1tjehXZEdQsZ9c8rDHQaMks5vZBPPgaJpZM4bi5hl

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub<

https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftDocs%2Fazure-docs%2Fissues%2F26454%23issuecomment-475461631&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9a446f3216b941d4fbd108d6ae654544%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888147322181384&sdata=alSSigi1DjY4TEmxW%2BfuAWWgmiX1rb4u3BP%2FIRIkBKE%3D&reserved=0

,

or mute the thread<

https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAeRjbZnSCMI8K8z2kVoxExKQhK4vvXceks5vZDEJgaJpZM4bi5hl&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9a446f3216b941d4fbd108d6ae654544%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888147322191378&sdata=hUQYnESbVVav0hP4%2BYB6Q5rv9P0858d6dsRFBwE8hsc%3D&reserved=0

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475464703

,

or mute the thread <

https://github.com/notifications/unsubscribe-auth/AJui8K0n0341zGGTvSHvor643NLpjG3tks5vZDU6gaJpZM4bi5hl

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub<

https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftDocs%2Fazure-docs%2Fissues%2F26454%23issuecomment-475723897&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9f49bc07bd094727611708d6aef150c0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888748808737645&sdata=ga6%2BGoGN7hssVyiuC6L1VeCSrUsoMPJn%2FzyzOuFI4oc%3D&reserved=0 , or mute the thread<

https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAeRjbWf_7APTLwDR1JU3rI3QkDszlaSBks5vZRv8gaJpZM4bi5hl&data=02%7C01%7Cpatrick.lee%40microsoft.com%7C9f49bc07bd094727611708d6aef150c0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888748808747637&sdata=6Zcqv1Ei6TJw3a2OEskcurnoGlem%2B3GGALANnohzbzY%3D&reserved=0

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475744608 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AJui8ER-z5a8hfkJdSiTGHzkT5cpAvWyks5vZSnLgaJpZM4bi5hl

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub< https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftDocs%2Fazure-docs%2Fissues%2F26454%23issuecomment-475746973&data=02%7C01%7Cpatrick.lee%40microsoft.com%7Ca3f4b508150b4006178808d6aefa960d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888788623387250&sdata=uIGPjJEcZnLDSETvFnYOmgHNaG17UncDpJwq2OJ8iH4%3D&reserved=0>, or mute the thread< https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAeRjbfBU20AQIFoFLYIVXjU4ddNYfclbks5vZSuJgaJpZM4bi5hl&data=02%7C01%7Cpatrick.lee%40microsoft.com%7Ca3f4b508150b4006178808d6aefa960d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636888788623397248&sdata=T86PZhlzKcRWe%2FvImtoyjL%2BEOGP2uJ2tGCCFPINbHPY%3D&reserved=0

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-475751602, or mute the thread https://github.com/notifications/unsubscribe-auth/AJui8JbhZwDRG5LusFOukJgw5_4cupDsks5vZS8ygaJpZM4bi5hl .

aseandroid commented 5 years ago

Hello,

I found this little hack that worked for me:

Go to azure portal to your app service resource and then to Configuration (Preview). At Application Settings add a variable called "WEBSITES_PORT" and give it the value "80 -p 2222:2222". This will produce a docker build command that looks something like this:

docker run -d -p xxxx:80 --name -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITES_PORT=80 -p 2222:2222 -e DOCKER_CUSTOM_IMAGE_NAME= -e WEBSITE_SITE_NAME=xxxxxx -e WEBSITE_AUTH_ENABLED=False -e PORT=80 -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_INSTANCE_ID=xxxxx -e HTTP_LOGGING_ENABLED=1

If you also have ssh configured and running in your container, then you should be able to ssh into it via, for ex, the kudu tool

Hope this helps, Cheers

patricklee2 commented 5 years ago

@mattyweb Your directory structure is incorrect

Place this in the DockerFile in ROOT folder

# using the official LTS node image. might try slimmer version at some point.
FROM node:lts-slim

# set working directory and copy over files
WORKDIR /usr/src/app
COPY . .

# setting environment variables up for Azure staging environment (will use production for all Azure sites)
ENV NODE_ENV=production
ENV PORT=3001
ENV OPENWEATHER_APIKEY=ccf112262d9e4f0ba12c3cb05a8ba71b
ENV ACCUWEATHER_APIKEY=d41dfd5e8a1748d0970cba6637647d96
ENV API_URL=https://dayaxe-web-stage.azurewebsites.net/api/v1/
ENV API_DOMAIN=https://dayaxe-web-stage.azurewebsites.net/
ENV CDN_URL=https://cdn.dayaxe.com

# set up OpenSSL and ports for SSH
ENV SSH_PASSWD "root:Docker!"
RUN apt-get update \
        && apt-get install -y --no-install-recommends dialog \
        && apt-get update \
  && apt-get install -y --no-install-recommends openssh-server \
  && echo "$SSH_PASSWD" | chpasswd 

RUN rm -f /etc/ssh/sshd_config
RUN echo $PWD
RUN echo $(ls -al azure_startup)
COPY azure_startup/sshd_config /etc/ssh/
ENV SSH_PORT 2222
RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config
RUN chmod 755 azure_startup/docker_init.sh
ENV PATH ${PATH}:azure_startup

# expose some ports for access from web and azure kudu (SCM) container
EXPOSE 2222
EXPOSE 3001

# install and start the project
RUN npm i -g yarn
RUN yarn install --prod
RUN yarn build

ENTRYPOINT ["azure_startup/docker_init.sh"]

Your node app doesnt stay alive. If the main process ends then the docker container will exit as well. You can add a sleep-loop in the init file.

mattyweb commented 5 years ago

Hi all,

So have a bit of progress here. I have the image building and deploying to/from DockerHub and WebSSH is working.

I ended up configuring my Docker Hub credentials in the Azure web interface and that seemed to have done the trick. I still have the Docker DevOps task running in my deploy, but it didn't seem to do anything. Maybe there is a bug there? [image: image.png]

SSH is also now working on the Kudu site. I'm not sure how this was related to pulling from the private Docker Hub repo, but it will be helpful to be able to SSH. [image: image.png]

A few loose ends here:

Dockerfile location I moved the Dockerfile back to the root and that seems to have solved the problem with the COPY step. I don't love this however as we have multiple dockerfiles and now I can't have syntax highlighting on this one, but we can live with it.

Keep alive I didn't make any changes for this yet. Rather than putting a loop in the init file can I use the App Service "Always on" setting instead? The reason is that I'd like the production environment to be kept alive but staging/etc environments to sleep when they are not in use.

I'm a little nervous about the setup in general since I've got stuff set up in Dockerfiles, ENV variables, DevOps projects, and Azure itself. Seems like a lot of moving parts. But if it's working I'll be happy.

Would like your blessing/eyes to confirm things first, however.

Best, Matt

On Tue, Mar 26, 2019 at 12:20 PM Patrick notifications@github.com wrote:

@mattyweb https://github.com/mattyweb Your directory structure is incorrect

Place this in the DockerFile in ROOT folder

using the official LTS node image. might try slimmer version at some point.

FROM node:lts-slim

set working directory and copy over files

WORKDIR /usr/src/app COPY . .

setting environment variables up for Azure staging environment (will use production for all Azure sites)

ENV NODE_ENV=production ENV PORT=3001 ENV OPENWEATHER_APIKEY=ccf112262d9e4f0ba12c3cb05a8ba71b ENV ACCUWEATHER_APIKEY=d41dfd5e8a1748d0970cba6637647d96 ENV API_URL=https://dayaxe-web-stage.azurewebsites.net/api/v1/ ENV API_DOMAIN=https://dayaxe-web-stage.azurewebsites.net/ ENV CDN_URL=https://cdn.dayaxe.com

set up OpenSSL and ports for SSH

ENV SSH_PASSWD "root:Docker!" RUN apt-get update \ && apt-get install -y --no-install-recommends dialog \ && apt-get update \ && apt-get install -y --no-install-recommends openssh-server \ && echo "$SSH_PASSWD" | chpasswd

RUN rm -f /etc/ssh/sshd_config RUN echo $PWD RUN echo $(ls -al azure_startup) COPY azure_startup/sshd_config /etc/ssh/ ENV SSH_PORT 2222 RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config RUN chmod 755 azure_startup/docker_init.sh ENV PATH ${PATH}:azure_startup

expose some ports for access from web and azure kudu (SCM) container

EXPOSE 2222 EXPOSE 3001

install and start the project

RUN npm i -g yarn RUN yarn install --prod RUN yarn build

ENTRYPOINT ["azure_startup/docker_init.sh"]

Your node app doesnt stay alive. If the main process ends then the docker container will exit as well. You can add a sleep-loop in the init file.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MicrosoftDocs/azure-docs/issues/26454#issuecomment-476808335, or mute the thread https://github.com/notifications/unsubscribe-auth/AJui8J5AqnzzCKoiBJSWOgtHFp_9WiYmks5vanLxgaJpZM4bi5hl .

patricklee2 commented 5 years ago

@mattyweb I can't help you with the specific of your application

By default webapps are unloaded if they idle for 20 mins setting always on will keep you app alive by sending requests every 5 mins if your app closes on startup then docker will exit the container. Since the container exited, there is nothing to ssh into.

msangapu-msft commented 5 years ago

Hi team, there has been no activity on this thread for the past six weeks. I will proceed to close this issue today. @patricklee2 thank you for your help!

msangapu-msft commented 5 years ago

please-close

imduchy commented 3 years ago

Apologies for opening the issue again, but could you please provide a simple example for one of your blessed node images? E.g. appsvc/node:12-lts_20200522.6. I'm struggling to make this work and can't seem to find any examples. My Dockerfile currently looks the following.

// EDIT: See the bellow comment

imduchy commented 3 years ago

Took me a while to make it work, so I'll paste it here if anyone else needs an example. The setup might need some cleanup, but for now, I'm happy it works.

FROM appsvc/node:12-lts_20200522.6

# create destination directory
RUN mkdir -p /usr/src/tipovacka
WORKDIR /usr/src/tipovacka

# copy the app, note .dockerignore
COPY . /usr/src/tipovacka/
RUN npm install
RUN npm run build

COPY azure_startup.sh /home/site/wwwroot/
RUN chmod +x /home/site/wwwroot/azure_startup.sh

ENV NUXT_HOST=0.0.0.0
ENV NUXT_PORT=3000
ENV SSH_PORT 2222
ENV PM2HOME /pm2home
ENV PATH ${PATH}:/home/site/wwwroot

EXPOSE 3000
EXPOSE 2222

ENTRYPOINT ["/home/site/wwwroot/azure_startup.sh"]

and azure_startup

#!/usr/bin/env bash
cat >/etc/motd <<EOL 
  _____                               
  /  _  \ __________ _________   ____  
 /  /_\  \\___   /  |  \_  __ \_/ __ \ 
/    |    \/    /|  |  /|  | \/\  ___/ 
\____|__  /_____ \____/ |__|    \___  >
        \/      \/                  \/ 
A P P   S E R V I C E   O N   L I N U X
Documentation: http://aka.ms/webapp-linux
NodeJS quickstart: https://aka.ms/node-qs
NodeJS Version : `node --version`
EOL
cat /etc/motd

mkdir "$PM2HOME"
chmod 777 "$PM2HOME"
ln -s /home/LogFiles "$PM2HOME"/logs

# Get environment variables to show up in SSH session
eval $(printenv | sed -n "s/^\([^=]\+\)=\(.*\)$/export \1=\2/p" | sed 's/"/\\\"/g' | sed '/=/s//="/' | sed 's/$/"/' >> /etc/profile)

# starting sshd process
sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config
/usr/sbin/sshd

echo "Running npm start"
npm start