Tag Archive docker

Byphunsanit

จัดการ docker ง่ายๆ ด้วย portainer

เมื่อ docker มี container และ image มากขึ้นการที่ใช้ command จัดการเพิ่ม ลบ stop start โดยเฉพาะช่วงที่กำลังหัดเขียน dockerfile หรือ docker-compose การที่ใช้ตัวจัดการด้วย gui จะช่วยให้ทำได้เร็วขึ้น ตัว docker management อย่างเป็นทางการของ docker คือ kitematic แต่มีตัวอื่นที่ใช้ง่ายกว่า คือ portainer

เริ่มจากลองเข้าไปดูการใช้งานได้จากตัว demo demo.portainer.io username คือ admin และ password คือ tryportainer หรือชมจากภาพ DETAILED OVERVIEW ก่อนก็ได้ ถ้าเคยใช้ kitematic มาก่อนจะเห็นว่ามันน่าใช้กว่ามาก

การติดตั้งทำได้ง่ายๆ เพียง

  1. ใช้ command
    docker run --name  portainer -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer

    รอให้โหลด image เสร็จ

  2. เปิดเว็บ http://localhost:9000 กรอกข้อมูลผู้ใช้ รหัสผ่าน และเลือกการ connect แบบ local

แค่นี้ก็สามารถใช้ portainer จัดการกับ image และ container ได้แล้ว

ในครั้งต่อไปที่ต้องการเรียกใช้ให้ใช้ command

docker start  portainer

และเรียกใช้จาก http://localhost:9000 เหมือนเดิม