CathalMF
CathalMF

Reputation: 10055

Azure container app service. Docker Run parameters?

I have an app service in azure running a docker container.

The logs show it is running using the below docker run command. I have hidden some private company values.

docker run -d -p 4040:443 --name hidden -e WEBSITE_SITE_NAME=hidden -e WEBSITE_AUTH_ENABLED=False -e PORT=443 -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=hidden.azurewebsites.net -e WEBSITE_INSTANCE_ID=7d541a8f0aa7702237eea8e36b3c0321166514fdfef681b7755b6e82339b42dd -e HTTP_LOGGING_ENABLED=1 .azurecr.io/tests/hidden:20210310.4

Where is the -p 4040:443 being defined? I want it to be accessed on 443 so should be -p 443:443?

Upvotes: 2

Views: 1465

Answers (1)

Charles Xu
Charles Xu

Reputation: 31414

Of course, not. You can't define the port in the command docker run as you see in the log. Port 4040 is a random host port and it is chosen by Azure.

Azure App Service only exposes one port to the outside and it should be one between 80 and 443. But for the container inside the app service, you can expose any port you want. If the port the container exposes is not the same as the app service exposes, you need to add the environment variable WEBSITES_PORT with the value that the port you expose for the container.

For example, if the container exposes port 50000, and the app service exposes port 80 to access outside. Then you need to add the environment variable WEBSITES_PORT with the value of 50000.

Upvotes: 0

Related Questions