Configure the Linux Firewall for Docker Swarm on Ubuntu

15 Dec 2017,
Share: 

บทความนี้จะเกี่ยวข้องกับการ Config Linux Firewall ให้สามารถใช้งาน Docker swarm ได้ ถ้าไม่ได้ Config เราจะเจอกับ Error นี้ “Timeout was reached before node was joined. The attempt to join the swarm will continue in the background. Use the “docker info” command to see the current swarm status of your node.” ในขั้นตอนการ Join Swarm เพราะว่า Docker Swarm ใช้งาน port ดังต่อไปนี้

  • TCP port 2376 for secure Docker client communication. This port is required for Docker Machine to work. Docker Machine is used to orchestrate Docker hosts.
  • TCP port 2377. This port is used for communication between the nodes of a Docker Swarm or cluster. It only needs to be opened on manager nodes.
  • TCP and UDP port 7946 for communication among nodes (container network discovery).
  • UDP port 4789 for overlay network traffic (container ingress networking).

ดังนั้นเราจึงต้องไป config firewall เพื่อให้สามารถใช้งานได้ มีขั้นตอนดังนี้ ใช้คําสั่งตามลําดับดังนี้ได้เลยครับ

ufw allow 22/tcp
ufw allow 2376/tcp
ufw allow 2377/tcp
ufw allow 7946/tcp
ufw allow 7946/udp
ufw allow 4789/udp

reload UFW ด้วยคําสั่ง

ufw reload

Enable UFW ด้วยคําสั่ง

ufw enable

Restart docker engin

systemctl restart docker

เท่านี้เราก็สามารถใช้งาน Docker Swarm ได้แล้วครับ :)

Suggestion blogs

Unbox ไฟฉาย Nitecore TIP 2017

ไฟฉาย Nitecore รุ่น TIP Version 2017 เป็นไฟฉายรุ่นที่ที่มีความสว่างสูงสุด 360 Lumens แสงพุ่งไกลถึง 74 เมตร จุดเด่นของรุ่นนี้คือ เป็นไฟฉายที่มีขนาดเล็กแต่ให้ความสว่างสูง มีแบตเตอรี่ภายใน คุณสมบัติโดยทั่วไปดังนี้

การใช้ Real time clock กับ Raspberry pi

ใน Raspberry pi จะไม่มี Real Time Clock มาให้ เมื่อเราปิดเครื่อง หรือไม่มีไฟฟ้าจ่ายให้กับ Raspberry pi วันที่และเวลาของเครื่องจะไม่เป็นปัจจุบัน วิธีที่จะทําให้เวลาของเครื่องเป็นวันที่ปัจจุบันมีด้วยกัน 2 วิธี ดังนี้ใช้ NTP server (จะต้องเชื่อมต่อกับเครือขาย internet)ใช้ Real time clock (ไม่ต้องเชื่อมต่อกับเครือขาย internet)ในบทความนี้เราจะอธิบายวิธีใช้ Real time clock เป็นฐานเวลาให้กับ Raspberry pi ก่อนอื่นมารู้จักกันก่อนว่ามันคืออะไร Real time clock เป็น module ฐานเวลา เนื่องจากตัว module ใช้พลังงานจากถ่านกระดุมขนาดเล็กทําให้ตัว module ทํางานอยู่ตลอดเวลาแม้ไม่ได้จ่ายไฟเลี้ยง

Disable service worker ใน React

Service Worker คือ JavaScript ทำงานบนเว็บเบราเซอร์ ซึ่งจะทำงานอยู่เบื้องหลังแยกออกจากตัวเว็บโดยตัว Service Worker นิยมใช้ทำ Offline mode ที่เราพบเห็นจากเว็บส่วนใหญ่ของ Google รวมถึงการเพื่อทำ Web Push Notification และจะมีความสามารถอื่นๆ เพิ่มเข้ามาในอนาคต และ Service Worker สามารถดัก Network Request ของเว็บ เช่น HTTP Request, โหลดรูป หรือ API Call โดยทุก Request ที่ออกจากเว็บเราจะผ่าน Service worker ทั้งหมดทำให้เราสามารถจัดการ Network Request ได้ดีขึ้น เช่น การคืนค่าจาก Cache แทนที่จะส่ง Request นั้นออกไปจริงๆ หรือในกรณีที่ไม่สามารถเชื่อมต่ออินเตอร์เน็ตได้


Copyright © 2019 - 2025 thiti.dev |  v1.53.0 |  Privacy policy | 

Build with ❤️ and Astro.

Github profile   Linkedin profile   Instagram   X profile   Nostr   Youtube channel   Telegram   Email contact   วงแหวนเว็บ