-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #220 from pingkunga/add-docker-build-and-reorder
add docker build content and reorder .NET Faq + Docker
- Loading branch information
Showing
16 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
title: Debugging | ||
showMetadata: true | ||
editable: true | ||
order: 1 | ||
--- | ||
|
||
# Collection of FAQ about debugging | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
--- | ||
title: Docker build | ||
showMetadata: true | ||
editable: true | ||
showToc: true | ||
order: 6 | ||
--- | ||
|
||
|
||
# Docker Build คือ อะไร | ||
|
||
build / buildx เป็นคำสั่งที่ช่วยแปลง Dockerfile ของเราไปเป็น Docker Image เพื่อเอาไปใช้งานต่อไป | ||
|
||
# การใช้งาน Docker Buid | ||
|
||
- [docker build](https://docs.docker.com/engine/reference/commandline/build/) รูปแบบการใช้งาน โดยที่ | ||
- `-t` กำหนดชื่อและ tag ของ image ที่จะสร้าง | ||
- `--no-cache` ไม่ใช้ cache ในการสร้าง image | ||
- `[context]` ตำแหน่งของ Dockerfile กรณีที่อยู่ใน directory เดียวกันกับ Dockerfile ให้ใช้ `.` แทน แต่ถ้าไม่ใช่ให้ใช้ path แทน | ||
- `-f ` กรณีที่กำหนด Dockerfile เป็นชื่ออื่น | ||
``` | ||
docker build -t <Container_name:Tag_version> --no-cache [context] | ||
``` | ||
|
||
- ตัวอย่างการใช้งาน | ||
|
||
``` | ||
docker build -t inv-api:1.0.0 . | ||
``` | ||
|
||
- ตัวอย่างการใช้งาน กรณีที่แยกกำหนดชื่อ Dockerfile เป็นชื่ออื่น | ||
|
||
``` | ||
docker build -t inv-api:1.0.0 -f Dev.DockerFile | ||
``` | ||
|
||
- ตัวอย่างการใช้งาน กรณีที่ไม่ใช้ cache ในการสร้าง image | ||
|
||
``` | ||
docker build -t inv-api:1.0.0 --no-cache -f Prod.DockerFile | ||
``` | ||
|
||
# การใช้งาน Docker Buildx | ||
|
||
เนื่องการจากการใช้งาน docker build เดิมมีข้อจำกัดเรื่องของ Platform ทำให้เกิดปัญหาว่านักพัฒนาที่ใช้ CPU ARM ต้องไปหาเครื่องที่เป็น x86 / amd64 เพื่อ Build และใช้งาน ทาง docker เลยแก้ปัญหา โดยการพัฒนา [docker buildx](https://docs.docker.com/engine/reference/commandline/buildx/) ขึ้นมา | ||
|
||
- build & push ขึ้น docker hub | ||
หมายเหตุ ถ้า Build เฉยๆ เราจะไม่ได้ image ออกมา | ||
|
||
``` | ||
docker buildx build --push --platform <platform> -t <Container_name:Tag_version> <context> | ||
``` | ||
|
||
- ตัวอย่าง build & push ขึ้น docker hub | ||
|
||
``` | ||
docker buildx build --push --platform linux/amd64,linux/arm64 -t pingkunga/first-buildx:1.0.0 . | ||
``` | ||
|
||
- build & load เข้า local registry ของเครื่องเรา | ||
ข้อจำกัด บิ้วได้ทีละ 1 platform | ||
|
||
``` | ||
docker buildx build --load --platform <platform> -t <Container_name:Tag_version> <context> | ||
``` | ||
|
||
- ตัวอย่าง build & load เข้า local registry ของเครื่องเรา | ||
``` | ||
docker buildx build --load --platform linux/amd64 -t pingkunga/first-buildx:1.0.0 . | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ title: Docker container | |
showMetadata: true | ||
editable: true | ||
showToc: true | ||
order: 3 | ||
--- | ||
|
||
# Tips | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ title: Docker context | |
showMetadata: true | ||
editable: true | ||
showToc: true | ||
order: 2 | ||
--- | ||
|
||
# Docker Context | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ title: .NET | |
showMetadata: true | ||
showToc: true | ||
tocDepth: 1 | ||
order: 1 | ||
--- | ||
|
||
# Collection of FAQ about .NET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
title: VPN | ||
showMetadata: true | ||
editable: true | ||
order: 7 | ||
--- |