Q:

Why is nginx redirect not working with Docker container? 

I want to redirect a user when they go to https to the http version of my website which is hosted in a Docker swarm.   
I'm trying to do this using ngnix, however the setup that I'm using isn't working.   I've created a new Core 2.0 Web App to try and get it working in the simplest context possible.   In addition to the Web App I also have my Dockerfile:
FROM microsoft/aspnetcore-build:2.0 AS build-env
WORKDIR /app

# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore

# Copy everything else and build
COPY . ./ 
RUN dotnet publish -c Release -o out

# Build nginx image to redirect http to https
FROM nginx:alpine

EXPOSE 80
COPY nginx.conf /etc/nginx/nginx.conf

# Build runtime image
FROM microsoft/aspnetcore:2.0
WORKDIR /app
COPY --from=build-env /app/out . 
ENTRYPOINT ["dotnet", "RedirectService.dll"]

and my nginx file: 
server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name _;
    return 301 https://www.google.co.uk;
}

After building my image, I run it with docker run -p 8006:80 redirectservice.   What I'm expecting to happen is that it will redirect me to Google when I navigate to http://localhost:8006, however no redirect happens.   
Can anyone see anything that I'm doing wrong?   Any help would be massively appreciated. 

A:

It's not redirecting you, because nginx process is not running. 
Take a look at the nginx image Dockerfile (https://github.com/nginxinc/docker-nginx/blob/590f9ba27d6d11da346440682891bee6694245f5/mainline/alpine/Dockerfile) - last line is:
CMD ["nginx", "-g", "daemon off;"]

In your Dockerfile you replaced it with:
ENTRYPOINT ["dotnet", "RedirectService.dll"]

And thus the nginx is never started. 
You need to create a sh script where you will run nginx and dotnet and wait until both of them ends (i.e. crashes).