Skip to content

Commit

Permalink
Add --platform to Docker CLI examples in docs
Browse files Browse the repository at this point in the history
Docker supports multiple platforms  (combinations of operating system
and CPU architecture) that can be supplied to the Docker CLI with the
`--platform` argument. inboard currently only builds for `linux/amd64`,
also known as `x86_64`. This commit will add `--platform` to Docker CLI
examples in the docs to help users avoid warnings like this:

```text
WARNING:
The requested image's platform (linux/amd64) does not match the detected
host platform (linux/arm64/v8) and no specific platform was requested
```

https://docs.docker.com/build/building/multi-platform/
https://github.com/containerd/platforms
https://github.com/opencontainers/image-spec/blob/036563a/specs-go/v1/descriptor.go#L52-L72
  • Loading branch information
br3ndonland committed Jul 14, 2024
1 parent 49914dd commit 76a21b8
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ _Why use this project?_ You might want to try out inboard because it:

```sh
docker pull ghcr.io/br3ndonland/inboard
docker run -d -p 80:80 ghcr.io/br3ndonland/inboard
docker run -d -p 80:80 --platform linux/amd64 ghcr.io/br3ndonland/inboard
http :80 # HTTPie: https://httpie.io/
```

Expand Down
2 changes: 2 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"codespace",
"codespaces",
"codium",
"containerd",
"dependabot",
"dockerfiles",
"dotenv",
Expand All @@ -61,6 +62,7 @@
"mypy",
"ndonland",
"noqa",
"opencontainers",
"pipx",
"postinstallation",
"prereleases",
Expand Down
2 changes: 1 addition & 1 deletion docs/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Server:

```sh
docker pull ghcr.io/br3ndonland/inboard
docker run -d -p 80:80 \
docker run -d -p 80:80 --platform linux/amd64 \
-e "BASIC_AUTH_USERNAME=test_user" \
-e "BASIC_AUTH_PASSWORD=r4ndom_bUt_memorable" \
ghcr.io/br3ndonland/inboard
Expand Down
12 changes: 6 additions & 6 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,23 +149,23 @@ docker build . --rm --target starlette -t localhost/br3ndonland/inboard:starlett
# Run Docker container with Uvicorn and reloading
cd inboard

docker run -d -p 80:80 \
docker run -d -p 80:80 --platform linux/amd64 \
-e "BASIC_AUTH_USERNAME=test_user" \
-e "BASIC_AUTH_PASSWORD=r4ndom_bUt_memorable" \
-e "LOG_LEVEL=debug" \
-e "PROCESS_MANAGER=uvicorn" \
-e "WITH_RELOAD=true" \
-v $(pwd)/inboard:/app/inboard localhost/br3ndonland/inboard:base

docker run -d -p 80:80 \
docker run -d -p 80:80 --platform linux/amd64 \
-e "BASIC_AUTH_USERNAME=test_user" \
-e "BASIC_AUTH_PASSWORD=r4ndom_bUt_memorable" \
-e "LOG_LEVEL=debug" \
-e "PROCESS_MANAGER=uvicorn" \
-e "WITH_RELOAD=true" \
-v $(pwd)/inboard:/app/inboard localhost/br3ndonland/inboard:fastapi

docker run -d -p 80:80 \
docker run -d -p 80:80 --platform linux/amd64 \
-e "BASIC_AUTH_USERNAME=test_user" \
-e "BASIC_AUTH_PASSWORD=r4ndom_bUt_memorable" \
-e "LOG_LEVEL=debug" \
Expand All @@ -174,15 +174,15 @@ docker run -d -p 80:80 \
-v $(pwd)/inboard:/app/inboard localhost/br3ndonland/inboard:starlette

# Run Docker container with Gunicorn and Uvicorn
docker run -d -p 80:80 \
docker run -d -p 80:80 --platform linux/amd64 \
-e "BASIC_AUTH_USERNAME=test_user" \
-e "BASIC_AUTH_PASSWORD=r4ndom_bUt_memorable" \
localhost/br3ndonland/inboard:base
docker run -d -p 80:80 \
docker run -d -p 80:80 --platform linux/amd64 \
-e "BASIC_AUTH_USERNAME=test_user" \
-e "BASIC_AUTH_PASSWORD=r4ndom_bUt_memorable" \
localhost/br3ndonland/inboard:fastapi
docker run -d -p 80:80 \
docker run -d -p 80:80 --platform linux/amd64 \
-e "BASIC_AUTH_USERNAME=test_user" \
-e "BASIC_AUTH_PASSWORD=r4ndom_bUt_memorable" \
localhost/br3ndonland/inboard:starlette
Expand Down
12 changes: 8 additions & 4 deletions docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,24 +232,28 @@ The image could then be built with:

```sh
cd /path/to/repo
docker build . -t imagename:latest
docker build --platform linux/amd64 -t imagename:latest .
```

The final argument is the Docker image name (`imagename` in this example). Replace with your image name.
Replace `imagename` with your image name.

!!! info "Docker platforms"

[Docker supports multiple platforms](https://docs.docker.com/build/building/multi-platform/) (combinations of operating system and CPU architecture) that can be supplied to the Docker CLI with the `--platform` argument. inboard currently only builds for the `linux/amd64` platform, also known as `x86_64`. See [containerd/platforms](https://github.com/containerd/platforms) and [opencontainers/image-spec](https://github.com/opencontainers/image-spec/blob/036563a4a268d7c08b51a08f05a02a0fe74c7268/specs-go/v1/descriptor.go#L52-L72) for more details on available platforms.

## Run containers

Run container:

```sh
docker run -d -p 80:80 imagename
docker run -d -p 80:80 --platform linux/amd64 imagename
```

Run container with mounted volume and Uvicorn reloading for development:

```sh
cd /path/to/repo
docker run -d -p 80:80 \
docker run -d -p 80:80 --platform linux/amd64 \
-e "LOG_LEVEL=debug" -e "PROCESS_MANAGER=uvicorn" -e "WITH_RELOAD=true" \
-v $(pwd)/package:/app/package imagename
```
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ _Why use this project?_ You might want to try out inboard because it:

```sh
docker pull ghcr.io/br3ndonland/inboard
docker run -d -p 80:80 ghcr.io/br3ndonland/inboard
docker run -d -p 80:80 --platform linux/amd64 ghcr.io/br3ndonland/inboard
http :80 # HTTPie: https://httpie.io/
```

Expand Down

0 comments on commit 76a21b8

Please sign in to comment.