Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you expose port 3000 using an Azure Web App Container?

Tags:

I'm running a react boilerplate app within a docker container, hosted Azure Web App Containers.

Locally, I spin the app up with:

docker run -p 3000:3000 431e522f8a87 

My docker file looks like this:

FROM node:8.9.3 EXPOSE 3000 RUN mkdir -p src WORKDIR /src ADD . /src RUN yarn install RUN yarn build  CMD ["yarn", "run", "start:prod"] 

APPLICATION SETTINGS

I've tried editing the Application Settings, to no avail, with the key/value pair: WEBSITES_PORT=3000

Apparently Azure only exposes ports 80 and 443 for inbound traffic:

80: Default port for inbound HTTP traffic to apps running in App Service Plans in an App Service Environment. On an ILB-enabled ASE, this port is bound to the ILB address of the ASE.

443: Default port for inbound SSL traffic to apps running in App Service Plans in an App Service Environment. On an ILB-enabled ASE, this port is bound to the ILB address of the ASE.

How do I expose port 3000 in an Azure App Service?

like image 614
Dave Voyles Avatar asked Feb 08 '18 20:02

Dave Voyles


People also ask

Can we expose a port on running container?

There are several ways to do this: you can expose a port via the --expose flag at runtime, or include an EXPOSE instruction in the Dockerfile. You can also publish ports by using the -p or -P flags in the Docker run string. There's also container linking via --link .

How do I configure port Azure App Service?

On the left pane, navigate to the Settings section and then select Configuration. In the Application settings tab of Configuration, click New application setting to create a new setting for your web app service. In the Add/Edit application setting dialog box, enter the name and port for the website.

How do I map a port to a container?

Ways to Assign a New Port Mapping to a Running ContainerStart over by stopping the existing container and relaunching a new one with the same original Docker image. Commit the existing container and relaunch a new container from the committed Docker image, keeping the state of the container we're trying to access.


1 Answers

User 4c74356b41 is correct.

In APPLICATION SETTINGS you need to set the key / value pair WEBSITES_PORT.

For some reason it's not working on this image, but I went through another example and did it all through the command line, and it worked fine.

like image 130
Dave Voyles Avatar answered Oct 05 '22 11:10

Dave Voyles