Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mozillazg/binaryless
Binaryless Base Images
https://github.com/mozillazg/binaryless
Last synced: 22 days ago
JSON representation
Binaryless Base Images
- Host: GitHub
- URL: https://github.com/mozillazg/binaryless
- Owner: mozillazg
- License: mit
- Created: 2021-06-02T14:41:11.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-01-31T05:02:00.000Z (almost 2 years ago)
- Last Synced: 2024-10-03T15:43:32.111Z (3 months ago)
- Language: Makefile
- Homepage:
- Size: 60.5 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Binaryless Base Images
不包含任何二进制可执行文件的容器基础镜像([binaryless 镜像介绍](https://mozillazg.com/2021/05/security-use-shell-less-and-binary-less-distroless-container-with-root-less-container.html) )。
## 提供的基础镜像
目前提供如下基础镜像:
* [binaryless/alpine:3.13](./alpine/)
* [binaryless/debian:10](./debian/)Docker Hub 地址:https://hub.docker.com/u/binaryless
## 使用方法
使用多阶段构建方法构建业务镜像:
```dockerfile
FROM golang:1.16 AS build-env
WORKDIR /go/src/github.com/mozillazg/binaryless/example/basic
COPY . .
RUN CGO_ENABLED=0 go build -ldflags '-extldflags "-static"'FROM binaryless/alpine:3.13
COPY --from=build-env /go/src/github.com/mozillazg/binaryless/example/basic/basic /basic
ENTRYPOINT ["/basic"]
# or
# CMD ["/basic"]
```* 因为镜像中不包含 shell 所以 `ENTRYPOINT` 和 `CMD` 指令的值格式必须是数组不能是字符串格式。
* 更多使用方法详见 [./examples](./examples/)## User
镜像中只包含如下 User:
* `uid=0(root)`
* `uid=65534(nobody)`默认 User 是 `65534(nobody)` 。
如果需要使用 root 用户的话,在 Dockerfile 中使用 `USER` 指令指定即可(`USER 0`)。