Public Repository

Last pushed: 3 years ago
Short Description
Full Description


  • 管理帳密:admin / admin
  • 部屬指令:docker run -d -p 8080:8080 pjhsiao/ubuntu:tomcat6_admin


Tomcat default run on port 8080

run -d will run in "detached" mode, in the background

run -p Publish a container's port to the host 8080:8080


  • 部屬指令:docker run -t -i -p 8080:80 dockerfile/nginx bash


這裡Nginx主要用來做 load balancer

Nginx default run on port 80

run -t Allocate a pseudo-TTY

run -i Keep STDIN open even if not attached

  • 運行的容器中修改 nginx settings:vi /etc/nginx/sites-available/default

  # Default server configuration
  # 手動加入upstream 和 tomcat server address
   upstream tomcat_cluster {
   #tomcat server address for cluster
   server; # 加入要叢集的tomcat server address
   server; # 加入要叢集的tomcat server address
server {
listen 80 default_server;
listen [::]:80 default_server;


server_name tomcat_cluster;

location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
           proxy_pass http://tomcat_cluster; #【use upstream name】
           proxy_set_header Host $host;
           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;
  • check nginx config:sudo service nginx configtest
  • run nginx :sudo service nginx restart
  • 參考網址

Docker Command Line

Docker Hub nginx

How To Set Up Nginx Load Balancing

Docker Pull Command