i want to create nginx docker image that i can manage nginx.config

for solve this problem i do it

create nginx.config that have this content: in /azizkhani/nginx

events {

  worker_connections  1024;


http {

  upstream sessionApp {

    server localhost:8082;

    server localhost:8081;


  server {

    listen 80;

    location / {

      proxy_pass http://sessionApp;



create DockerFile(without extension) : in  /azizkhani/nginx







FROM nginx

RUN mkdir -p /etc/nginx

COPY nginx.conf /etc/nginx/nginx.conf

and run this command in docker terminal after 

cd /azizkhani/nginx

docker build -t myNginxImage

and after create image 

run this command to create container from myNginxImage

$ docker run --name container-nginx-name -d -p8080:80 myNginxImage

request localhost and nginx show proxy(localhost:8081)