Skip to content
Knowledge Base

How to Build & Run for Host Nginx

Build the Image Run the Container Bound to Localhost Verify Host Port Security: Check that port 5000 is bound strictly to 127.0.0.1 and not 0.0.0.0: # 1. Symlink configuration if…

Updated 1 min readHosting

Build the Image

bash
docker build -t my-flask-app:1.0 .

Run the Container Bound to Localhost

text
docker run -d \
  --name flask-app \
  --restart unless-stopped \
  -p 127.0.0.1:5000:5000 \
  my-flask-app:1.0

Verify Host Port Security:

Check that port 5000 is bound strictly to 127.0.0.1 and not 0.0.0.0:

bash
sudo netstat -tulpn | grep 5000
# OR
sudo ss -tulpn | grep 5000

sudo ln -sf /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/

2. Verify Nginx configuration syntax

sudo nginx -t

3. Reload Nginx

sudo systemctl reload nginx

hosting/vultr/how-to-host-website/docker-way/README.md