nginx docker proxy reverse not displaying custom html page

I’m trying to setup a reverse proxy docker image which displays a custom static page on path “/” and proxies the incoming request to other services, but it’s not working.
This is my nginx.config:

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    server_name localhost;

    root /usr/share/nginx/html;
    index index.html;

    location / {
        try_files $uri $uri/ /index.html;

    location /my-service {
        proxy_pass          http://my-server:8080/;
        proxy_set_header    X-Forwarded-For $remote_addr;


and this is my Dockerfile

FROM nginx:latest
COPY ./nginx-html-template/ /usr/share/nginx/html/
COPY ./nginx.conf /etc/nginx/conf.d/nginx.conf
CMD ["nginx", "-g", "daemon off;", "-c", "/etc/nginx/nginx.conf"]

upon hitting localhost on my device I just get an ERR_CONNECTION_REFUSED error.

this are the commands I use to build the image and run:

docker build -t my-nginx .
docker run -it --rm -d -p 8080:80 --name localhost my-nginx

Have you got any idea? I have run out of options