Docker image custom nginx.conf

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Docker image custom nginx.conf



I am fairly new to this, I don't know if I am heading in the right direction or not. I have a custom nginx.conf that works fine, I am now trying to build a docker image with it so that I can run it as a container in kuberentes.



Here is my nginx.conf


user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
worker_connections 1024;
}


stream {
#define the various upstreams
upstream app_1 {
server 192.168.122.206:5678;
}

upstream app_2 {
server 192.168.122.206:9000;
}
#map source port to upstream
map $remote_port $backend_svr {
1234 "app_1";
1235 "app_2";
}
#all udp traffic received on 8000, depending on source it will be redirected
server {
listen 8000 udp;
proxy_pass $backend_svr;
}

}



On my virtual machine I have /home/asvilla/docker-files/nginx-udp/Dockerfile which contains


FROM nginx
RUN chmod +w /etc/nginx/nginx.conf
COPY nginx.conf /etc/nginx/nginx.conf
RUN cat /etc/nginx/nginx.conf



I build it using


docker build -t "custom_nginx:dockerfile" .



The nginx container should redirect udp traffic incoming on port 8000 to either port 5678 or port 9000 depending on the source of the udp packet.



I run with docker run 'image-id' but it doesn't function as expected. Running docker ps shows "PORTS 80/tcp "
and "COMMAND nginx-g daemon of ..."



Any pointers on what these mean. nginx by default binds tcp to port 80 but I have changed the nginx.conf, the cat command I run shows that the file is updated.



I am assuming that I have to expose the ports in the nginx.conf somehow. Any help much appreciated.









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

nW96wK,1E h VzEXUEVE
T5R,CYFQbejZoUL W

Popular posts from this blog

Makefile test if variable is not empty

Visual Studio Code: How to configure includePath for better IntelliSense results

Will Oldham