[Docker] Installation and tutorial
เนื่องจากเป็น post ที่เกี่ยวกับการลงโปรแกรมและ tutorial ที่แทบไม่ต้องพิมพ์
Installation
- LOAD!!!!!
2. DOUBLE CLICK TO INSTALL!!!!!
3. OK!!!!! Hyper-V คือ Feature ของ Windows ที่มี VMWare, WSL = Window Subsystem for Linux
4. WAIT!!!!! (Wait faster)
5. FINISH!!
****บางคนอาจจะมีปัญหาลงไม่ได้ เด้ง Dialog บอกว่าให้ Enabled Virtualization Technology ก็ไปเปิดใน BIOS กันนะ
***ถ้ามีปัญหาตาม Dialog นี้แสดงว่าไม่ได้ ลง WSL 2 ก็ไปลงตาม Step ด้านล่าง
แล้วก็เหมือนเดิมคือ LOAD!!!! แล้วลง!!!!
จากนั้นให้ Restart Docker ก็จะได้ตามภาพด้านล่าง
Tutorial
- Clone => ในขั้นตอนนี้เราจะได้รัน 2 คำสั่ง
คำสั่งแรกทำเพื่อดึง code จาก http://github.com/docker/getting-started.git แล้วเอามาสร้าง Container และ ทำการ copy folder ทีเ่พิ่งทำ เก็บไว้
docker run --name repo alpine/git clone http://github.com/docker/getting-started.gitdocker cp repo:/git/getting-started/ .
2. Build =>ในขั้นตอนนี้เราจะได้รัน 2 คำสั่ง
cd getting-started
docker build -t docker101tutorial .
นั้นคือ เข้าไปใน folder getting-started ที่เพิ่งสร้าง และ build docker image docker101tutorial
หลังจากรอ มัน build จนเสร็จแล้วก็จะสามารถ
3. RUN!!! container ที่สร้างเสร็จได้เลย => คำสั่งด้านล่าง เพื่อทำการ run container ที่ port 80 ชื่อ docker-tutorial ด้วย image docker101tutorial
docker run -d -p 80:80 --name docker-tutorial docker101tutorial
4. WAIT!!!! (Wait faster)
หลังจากที่เสร็จแล้ว เราก็จะมี container ที่รันอยู่
เมื่อกด open in browser ก็จะได้หน้าเว็บที่รันบน container จาก Image ที่ build มา
จบ
ถ้าทำ tutorial จบก็น่าจะพอเข้าใจ concept ของ Software container ที่ชื่อว่า docker กันแล้วนะครับ