GithubHelp home page GithubHelp logo

hhy5277 / distroless Goto Github PK

View Code? Open in Web Editor NEW

This project forked from googlecontainertools/distroless

0.0 3.0 0.0 102 KB

๐Ÿฅ‘ Language focused docker images, minus the operating system.

License: Apache License 2.0

Python 86.91% Shell 8.64% Go 2.41% Java 2.04%

distroless's Introduction

"Distroless" Docker Images

Build Status

"Distroless" images contain only your application and its runtime dependencies. They do not contain package managers, shells any other programs you would expect to find in a standard Linux distribution.

For more information, see this talk (video).

Why should I use distroless images?

Restricting what's in your runtime container to precisely what's necessary for your app is a best practice employed by Google and other tech giants that have used containers in production for many years. It improves the signal to noise of scanners (e.g. CVE) and reduces the burden of establishing provenance to just what you need.

How do I use distroless images?

These images are built using the bazel tool, but they can also be used through other Docker image build tooling.

Docker

Docker multi-stage builds make using distroless images easy. Follow these steps to get started:

  • Pick the right base image for your application stack We publish the following distroless base images on gcr.io:

  • Write a multi-stage docker file. Note: This requires Docker 17.05 or higher.

    The basic idea is that you'll have one stage to build your application artifacts, and insert them into your runtime distroless image. If you'd like to learn more, please see the documentation on multi-stage builds.

    Here's a quick example.

    # Start by building the application.
    FROM golang:1.8 as build
    
    WORKDIR /go/src/app
    COPY . .
    
    RUN go-wrapper download   # "go get -d -v ./..."
    RUN go-wrapper install
    
    # Now copy it into our base image.
    FROM gcr.io/distroless/base
    COPY --from=build /go/bin/app /
    CMD ["/app"]
    

Bazel

For full documentation on how to use bazel to generate Docker images, see the bazelbuild/rules_docker repository.

For documentation and examples on how to use the bazel package manager rules, see ./package_manager

Examples can be found in this repository in the examples directory.

Examples

We have some examples on how to run some common application stacks in the /examples directory. See here for:

See here for examples on how to complete some common tasks in your image:

See here for more information on how these images are built and released.

distroless's People

Contributors

aaron-prindle avatar dlorenc avatar f0 avatar gebi avatar iamzhout avatar jonjohnsonjr avatar markusteufelberger avatar mattmoor avatar r2d4 avatar salrashid123 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.