UBIイメージを使ってコンテナの脆弱性を最小限に抑える
Rags Srinivas
2020年3月27日
8 分で読めますSnykは、
コンテナの
この
Universal Base Image(UBI)とは?
201
技術的には
詳細は
UBIイメージの
UBIを使ったコンテナイメージの構築
まずはDockerfileの
flaskをDockerfileを
FROM python
ENV PORT 8080
EXPOSE 8080
WORKDIR /usr/src/app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
ENTRYPOINT ["python"]
CMD ["app.py"]ベースイメージにpythonを
FROM registry.redhat.io/ubi8/python-36
ENV PORT 8080
EXPOSE 8080
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
ENTRYPOINT ["python"]
CMD ["app.py"]以下のように、
docker build -t ragsns/example-python-ubi .UBIを
snyk test --container ragsns/example-python-ubi --file=Dockerfile
Testing ragsns/example-python-ubi...
✗ Low severity vulnerability found in npm
Description: RHEA-2020:0330
Info: https://snyk.io/vuln/SNYK-RHEL8-NPM-555355
Introduced through: npm@1:6.9.0-1.10.16.3.2.module+el8.0.0+4214+49953fda
From: npm@1:6.9.0-1.10.16.3.2.module+el8.0.0+4214+49953fda
Introduced by your base image (registry.redhat.io/ubi8/python-36)
Fixed in: 1:6.13.4-1.12.14.1.1.module+el8.1.0+5466+30f75629
✗ Low severity vulnerability found in nodejs
Description: RHEA-2020:0330
Info: https://snyk.io/vuln/SNYK-RHEL8-NODEJS-555347
Introduced through: nodejs@1:10.16.3-2.module+el8.0.0+4214+49953fda
From: nodejs@1:10.16.3-2.module+el8.0.0+4214+49953fda
Introduced by your base image (registry.redhat.io/ubi8/python-36)
Fixed in: 1:12.14.1-1.module+el8.1.0+5466+30f75629
✗ High severity vulnerability found in systemd-pam
Description: RHSA-2020:0575
Info: https://snyk.io/vuln/SNYK-RHEL8-SYSTEMDPAM-552042
Introduced through: systemd-pam@239-18.el8_1.2
From: systemd-pam@239-18.el8_1.2
Introduced by your base image (registry.redhat.io/ubi8/python-36)
Fixed in: 0:239-18.el8_1.4
✗ High severity vulnerability found in systemd-libs
Description: RHSA-2020:0575
Info: https://snyk.io/vuln/SNYK-RHEL8-SYSTEMDLIBS-552044
Introduced through: systemd-libs@239-18.el8_1.2
From: systemd-libs@239-18.el8_1.2
Introduced by your base image (registry.redhat.io/ubi8/python-36)
Fixed in: 0:239-18.el8_1.4
✗ High severity vulnerability found in systemd
Description: RHSA-2020:0575
Info: https://snyk.io/vuln/SNYK-RHEL8-SYSTEMD-552048
Introduced through: systemd@239-18.el8_1.2
From: systemd@239-18.el8_1.2
Introduced by your base image (registry.redhat.io/ubi8/python-36)
Fixed in: 0:239-18.el8_1.4
✗ High severity vulnerability found in npm
Description: RHSA-2020:0579
Info: https://snyk.io/vuln/SNYK-RHEL8-NPM-555375
Introduced through: npm@1:6.9.0-1.10.16.3.2.module+el8.0.0+4214+49953fda
From: npm@1:6.9.0-1.10.16.3.2.module+el8.0.0+4214+49953fda
Introduced by your base image (registry.redhat.io/ubi8/python-36)
Fixed in: 1:6.13.4-1.10.19.0.1.module+el8.1.0+5726+6ed65f8c
✗ High severity vulnerability found in npm
Description: RHSA-2020:0598
Info: https://snyk.io/vuln/SNYK-RHEL8-NPM-557042
Introduced through: npm@1:6.9.0-1.10.16.3.2.module+el8.0.0+4214+49953fda
From: npm@1:6.9.0-1.10.16.3.2.module+el8.0.0+4214+49953fda
Introduced by your base image (registry.redhat.io/ubi8/python-36)
Fixed in: 1:6.13.4-1.12.16.1.1.module+el8.1.0+5811+44509afe
✗ High severity vulnerability found in nodejs
Description: RHSA-2020:0579
Info: https://snyk.io/vuln/SNYK-RHEL8-NODEJS-555367
Introduced through: nodejs@1:10.16.3-2.module+el8.0.0+4214+49953fda
From: nodejs@1:10.16.3-2.module+el8.0.0+4214+49953fda
Introduced by your base image (registry.redhat.io/ubi8/python-36)
Fixed in: 1:10.19.0-1.module+el8.1.0+5726+6ed65f8c
✗ High severity vulnerability found in nodejs
Description: RHSA-2020:0598
Info: https://snyk.io/vuln/SNYK-RHEL8-NODEJS-557034
Introduced through: nodejs@1:10.16.3-2.module+el8.0.0+4214+49953fda
From: nodejs@1:10.16.3-2.module+el8.0.0+4214+49953fda
Introduced by your base image (registry.redhat.io/ubi8/python-36)
Fixed in: 1:12.16.1-1.module+el8.1.0+5811+44509afe
Organization: rags
Package manager: rpm
Target file: Dockerfile
Project name: docker-image|ragsns/example-python-ubi
Docker image: ragsns/example-python-ubi
Base image: registry.redhat.io/ubi8/python-36
Licenses: enabled
Tested 417 dependencies for known issues, found 9 issues.以下のように、
docker run -it -p8080:8080 ragsns/example-python-ubi
これは、
アプリケーションの
podman run -p 8080:8080 ragsns/example-python-ubi
Python言語の
複数の言語に対応するUBIイメージ
前述の
UBIイメージ | 依存関係 | 脆弱性 |
|---|---|---|
registry.redhat.io/ubi8/nodejs-10 | 373 | 9 |
registry.redhat.io/ubi8/python-36 | 417 | 9 |
registry.redhat.io/ubi8/ruby-26 | 481 | 9 |
registry.redhat.io/ubi8/php-73 | 403 | 9 |
registry.redhat.io/ubi8/go-toolset | 371 | 13 |
registry.redhat.io/ubi8/dotnet-21 | 248 | 10 |
幅広い
まとめと次のステップ
複数の
セキュリティの
Snykは、
開発者ファーストの コンテナセキュリティ
Snykは、



