How can I update my nginx config so the docker nginx will display my dockerized react website, both docker containers on the same host.

I can visit the react application through localhost at the published port but not directly through IP(or container name) and port of the container itself.

Nginx is up and I can hit the "welcome to nginx" page from localhost but I cannot see the react application.

Container deployment for react docker run --rm -p 8080:8000 --name hull hull-image

Container deployment for nginx docker run --rm -p 80:80 --link hull --name nginx-container nginx-reverse-proxy

access logs for nginx show access when I got to http://localhost, no errors logged.
When I docker network inspect a new network I created I see both containers on it.


user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
    server {
        listen 80;
        server_name hull;

    location / {
        proxy_pass http://hull:8000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

Nginx Docker file

FROM nginx:alpine

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

CMD ["nginx", "-g", "daemon off;"]# Use Nginx as the production server


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.