Docker Community Forums

Share and learn in the Docker community.

Nginx with local ip

i manage to get nginx running
5d2924f061f arm32v7/nginx “nginx -g 'daemon of…” 34 hours ago Up 34 hours 80/tcp, 0.0.0.0:5000->5000/tcp

but i am not able to access it with myip:5000

i can only access it with below ip

“IPAddress”: “172.17.0.4”

any help appretiated

please provide your nginx.conf.

defa3ae8251c arm32v7/nginx “nginx -g 'daemon of…” 4 minutes ago Up 4 minutes 80/tcp, 0.0.0.0:5000->5000/tcp jolly_euler

user nginx;
worker_processes 1;

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;

and below inspectBridge
EndpointID c07fa9d0aa9527714164439f7391a86e3a1ed1a37dedd11af6550f272fed251b
Gateway 172.17.0.1
GlobalIPv6Address
GlobalIPv6PrefixLen 0
HairpinMode false
IPAddress 172.17.0.4
IPPrefixLen 16
IPv6Gateway
LinkLocalIPv6Address
LinkLocalIPv6PrefixLen 0
MacAddress 02:42:ac:11:00:04
Networks { bridge: [object Object] }
Ports { 5000/tcp: [object Object], 80/tcp: null }
SandboxID 32f4c41de245df80b1e4907e606187190b021cbe91432827b51e542ad0916a16
SandboxKey /var/run/docker/netns/32f4c41de245
SecondaryIPAddresses

Since your nginx.conf has an include for include /etc/nginx/conf.d/*.conf;.
I wanted to see if you actualy listen on 5000 for a defined server…

By default port 80 should be bound, shouldn’t it?

1 Like

here is how i started container
docker run -d -it -p 5000:5000 arm32v7/nginx

oot@defa3ae8251c:/# cat /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;

#charset koi8-r;
#access_log  /var/log/nginx/host.access.log  main;

location / {
    root   /usr/share/nginx/html;
    index  index.html index.htm;
}

#error_page  404              /404.html;

# redirect server error pages to the static page /50x.html
#
error_page   500 502 503 504  /50x.html;
location = /50x.html {
    root   /usr/share/nginx/html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
#    proxy_pass   http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
#    root           html;
#    fastcgi_pass   127.0.0.1:9000;
#    fastcgi_index  index.php;
#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
#    include        fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
#    deny  all;
#}

}

thank you , i edited now the file for 5000 and works

thanks