Skip to content

Commit

Permalink
Merge pull request #9 from gongna-au/feature/command
Browse files Browse the repository at this point in the history
feat: update docker buildx command
  • Loading branch information
gongna-au authored Aug 27, 2024
2 parents 1cab755 + ba42e0f commit ed86ff5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions _posts/2024-07-29-test-markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,27 @@ docker buildx build --platform linux/arm64 -t your-image-name:your-tag .
注意
- 在 Apple M1 上,默认构建的镜像是 ARM 架构的
- 如果需要构建适用于不同架构(如 amd64)的镜像,需要在 Buildx 命令中指定相应的平台。

```shell
docker buildx build --platform linux/arm64 -t test:v1.2 .
docker buildx build --platform linux/arm64 -t test:v1.2 . --load
```

```shell
docker run --privileged -it --platform linux/arm64 -v $(pwd):/demo test:v1.2 /bin/bash
```

```shell
docker buildx build --platform linux/amd64 -t test:v1.2 .
docker buildx build --platform linux/amd64 -t test:v1.2 . --load
```

```shell
docker run --privileged -it --platform linux/amd64 -v $(pwd):/demo test:v1.2 /bin/bash
```

没有加--load参数的时候,不会把镜保存到本地🤣,所以我一般都是用第二个命令。
一个完整的用例如下:

```shell
docker buildx build --platform linux/amd64 -t test:v1.2 . --load
Expand Down

0 comments on commit ed86ff5

Please sign in to comment.