Update cassandra (#22034)
Changes:
- https://github.com/docker-library/cassandra/commit/ef6e6bd: Merge pull request https://github.com/docker-library/cassandra/pull/293 from infosiftr/6.0-plus-trixie
- https://github.com/docker-library/cassandra/commit/929d3a1: add 6.0-rc; move 5.0 to trixie
Co-authored-by: Docker Library Bot doi+docker-library-bot@docker.com
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
Docker Official Images
Table of Contents
What are “Official Images”?
The Docker Official Images are curated images hosted on Docker Hub. The main tenets are:
Focus on Free and Open-Source Software
Support multiple architectures
Exemplify
Dockerfilebest practicesActively rebuild for updates and security fixes
Adhere to upstream recommendations
Add minimal quality-of-life behavior for the container environment where fit
See Docker’s documentation for a good high-level overview of the program.
In essence we strive to heed upstream’s recommendations on how they intend for their software to be consumed. Many images are maintained in collaboration with the relevant upstream project if not maintained directly by them. Additionally we aim to exemplify the best practices for Dockerfiles to serve as a reference when making or deriving your own images from them.
(If you are a representative of an upstream for which there exists an image and you would like to get involved, please see the Maintainership section below!)
Architectures other than amd64?
Some images have been ported for other architectures, and many of these are officially supported (to various degrees).
arm32v6): https://hub.docker.com/u/arm32v6/ - ARMv7 32-bit (arm32v7): https://hub.docker.com/u/arm32v7/ - ARMv8 64-bit (arm64v8): https://hub.docker.com/u/arm64v8/ - Linux x86-64 (amd64): https://hub.docker.com/u/amd64/ - Windows x86-64 (windows-amd64): https://hub.docker.com/u/winamd64/arm32v5): https://hub.docker.com/u/arm32v5/ - IBM POWER8 (ppc64le): https://hub.docker.com/u/ppc64le/ - IBM z Systems (s390x): https://hub.docker.com/u/s390x/ - RISC-V 64-bit (riscv64): https://hub.docker.com/u/riscv64/ - x86/i686 (i386): https://hub.docker.com/u/i386/These other architectures are included under the non-prefixed images via OCI “image indexes”, such that, for example,
docker run hello-worldshould run as-is on all supported platforms.If you’re curious about how these are built, head over to our FAQ entry to see an explanation of the process or visit meta-scripts to see the build process source files.
See the multi-arch section below for recommendations in adding more architectures to an official image.
More FAQs?
Yes! We have a dedicated FAQ repository where we try to collect other common questions (both about the program and about our practices).
Contributing to the standard library
Thank you for your interest in the Docker official images project! We strive to make these instructions as simple and straightforward as possible, but if you find yourself lost, don’t hesitate to seek us out on Libera.Chat IRC in channel
#docker-libraryor by creating a GitHub issue here.Be sure to familiarize yourself with Official Repositories on Docker Hub and the Best practices for writing Dockerfiles in the Docker documentation. These will be the foundation of the review process performed by the official images maintainers. If you’d like the review process to go more smoothly, please ensure that your
Dockerfiles adhere to all the points mentioned there, as well as below, before submitting a pull request.Also, the Hub descriptions for these images are currently stored separately in the
docker-library/docsrepository, whoseREADME.mdfile explains more about how it’s structured and how to contribute to it. Please be prepared to submit a PR there as well, pending acceptance of your image here.Review Guidelines
Because the official images are intended to be learning tools for those new to Docker as well as the base images for advanced users to build their production releases, we review each proposed
Dockerfileto ensure that it meets a minimum standard for quality and maintainability. While some of that standard is hard to define (due to subjectivity), as much as possible is defined here, while also adhering to the “Best Practices” where appropriate.A checklist which may be used by the maintainers during review can be found in
NEW-IMAGE-CHECKLIST.md.Maintainership
Version bumps and security fixes should be attended to in a timely manner.
If you do not represent upstream and upstream becomes interested in maintaining the image, steps should be taken to ensure a smooth transition of image maintainership over to upstream.
For upstreams interested in taking over maintainership of an existing repository, the first step is to get involved in the existing repository. Making comments on issues, proposing changes, and making yourself known within the “image community” (even if that “community” is just the current maintainer) are all important places to start to ensure that the transition is unsurprising to existing contributors and users.
When taking over an existing repository, please ensure that the entire Git history of the original repository is kept in the new upstream-maintained repository to make sure the review process isn’t stalled during the transition. This is most easily accomplished by forking the new from the existing repository, but can also be accomplished by fetching the commits directly from the original and pushing them into the new repo (ie,
git fetch https://github.com/jsmith/example.git master,git rebase FETCH_HEAD,git push -f). On GitHub, an alternative is to move ownership of the git repository. This can be accomplished without giving either group admin access to the other owner’s repository:Repeatability
Rebuilding the same
Dockerfileshould result in the same version of the image being packaged, even if the second build happens several versions later, or the build should fail outright, such that an inadvertent rebuild of aDockerfiletagged as0.1.0doesn’t end up containing0.2.3. For example, if usingaptto install the main program for the image, be sure to pin it to a specific version (ex:... apt-get install -y my-package=0.1.0 ...). For dependent packages installed byaptthere is not usually a need to pin them to a version.No official images can be derived from, or depend on, non-official images (allowing the non-image
scratchand the intentionally limited exceptions pinned in.external-pins– see also.external-pins/list.sh).Consistency
All official images should provide a consistent interface. A beginning user should be able to
docker run official-image bash(orsh) without needing to learn about--entrypoint. It is also nice for advanced users to take advantage of entrypoint, so that they candocker run official-image --arg1 --arg2without having to specify the binary to execute.CMD:ENTRYPOINTalong withCMD:ENTRYPOINT, since that is the only thing that can run:Clarity
Try to make the
Dockerfileeasy to understand/read. It may be tempting, for the sake of brevity, to put complicated initialization details into a standalone script and merely add aRUNcommand in theDockerfile. However, this causes the resultingDockerfileto be overly opaque, and suchDockerfiles are unlikely to pass review. Instead, it is recommended to put all the commands for initialization into theDockerfileas appropriateRUNorENVcommand combinations. To find good examples, look at the current official images.Some examples at the time of writing:
init
Following the Docker guidelines it is highly recommended that the resulting image be just one concern per container; predominantly this means just one process per container, so there is no need for a full init system. There are two situations where an init-like process would be helpful for the container. The first being signal handling. If the process launched does not handle
SIGTERMby exiting, it will not be killed since it is PID 1 in the container (see “NOTE” at the end of the Foreground section in the docker docs). The second situation would be zombie reaping. If the process spawns child processes and does not properly reap them it will lead to a full process table, which can prevent the whole system from spawning any new processes. For both of these concerns we recommend tini. It is incredibly small, has minimal external dependencies, fills each of these roles, and does only the necessary parts of reaping and signal forwarding.Be sure to use tini in
CMDorENTRYPOINTas appropriate.It is best to install tini from a distribution-provided package (ex.
apt-get install tini). If tini is not available in your distribution or is too old, here is a snippet of aDockerfileto add in tini:Cacheability
This is one place that experience ends up trumping documentation for the path to enlightenment, but the following tips might help:
COPY/ADDwhenever possible, but when necessary, be as specific as possible (ie,COPY one-file.sh /somewhere/instead ofCOPY . /somewhere).Security
Image Build
The
Dockerfileshould be written to help mitigate interception attacks during build. Our requirements focus on three main objectives: verifying the source, verifying author, and verifying the content; these are respectively accomplished by the following: using https where possible; importing PGP keys with the full fingerprint in theDockerfileto check signatures; embedding checksums directly in theDockerfile. All three should be used when possible. Just https and embedded checksum can be used when no signature is published. As a last resort, just an embedded checksum is acceptable if the site doesn’t have https available and no signature.The purpose in recommending the use of https for downloading needed artifacts is that it ensures that the download is from a trusted source which also happens to make interception much more difficult.
The purpose in recommending PGP signature verification is to ensure that only an authorized user published the given artifact. When importing PGP keys, please use the the
keys.openpgp.orgservice when possible (preferringkeyserver.ubuntu.comotherwise). See also the FAQ section on keys and verification.The purpose in recommending checksum verification is to verify that the artifact is as expected. This ensures that when remote content changes, the Dockerfile also will change and provide a natural
docker buildcache bust. As a bonus, this also prevents accidentally downloading newer-than-expected artifacts on poorly versioned files.Below are some examples:
ascverification, embedded checksum verified.Dockerfile.Runtime Configuration
By default, Docker containers are executed with reduced privileges: whitelisted Linux capabilities, Control Groups, and a default Seccomp profile (1.10+ w/ host support). Software running in a container may require additional privileges in order to function correctly, and there are a number of command line options to customize container execution. See
docker runReference and Seccomp for Docker for reference.Official Repositories that require additional privileges should specify the minimal set of command line options for the software to function, and may still be rejected if this introduces significant portability or security issues. In general,
--privilegedis not allowed, but a combination of--cap-addand--deviceoptions may be acceptable. Additionally,--volumecan be tricky as there are many host filesystem locations that introduce portability/security issues (e.g. X11 socket).Security Releases
For image updates which constitute a security fix, there are a few things we recommend to help ensure your update is merged, built, and released as quickly as possible:
doi@docker.coma few (business) days in advance to give us a heads up and a timing estimate (so we can schedule time for the incoming update appropriately).[security]in the title of your pull request (for example,[security] Update FooBar to 1.2.5, 1.3.7, 2.0.1).Multiple Architectures
Each repo can specify multiple architectures for any and all tags. If no architecture is specified, images are built in Linux on
amd64(aka x86-64). To specify more or different architectures, use theArchitecturesfield (comma-delimited list, whitespace is trimmed). Valid architectures are found in Bashbrew’soci-platform.gofile:amd64arm32v6arm32v7arm64v8i386ppc64leriscv64s390xwindows-amd64The
Architecturesof any given tag must be a strict subset of theArchitecturesof the tag it isFROM.Images must have a single
Dockerfileper entry in the library file that can be used for multiple architectures. This means that each supported architecture will have the sameFROMline (e.g.FROM debian:bookworm). Seegolang,docker,haproxy, andphpfor examples of library files using oneDockerfileper entry and see their respective git repos for exampleDockerfiles.If different parts of the Dockerfile only happen in one architecture or another, use control flow (e.g.
if/case) along withdpkg --print-architectureorapk -print-archto detect the userspace architecture. Only useunamefor architecture detection when more accurate tools cannot be installed. See golang for an example where some architectures require building binaries from the upstream source packages and some merely download the binary release.For base images like
debianit will be necessary to have a differentDockerfileand build context in order toADDarchitecture specific binaries and this is a valid exception to the above. Since these images use the sameTags, they need to be in the same entry. Use the architecture specific fields forGitRepo,GitFetch,GitCommit, andDirectory, which are the architecture concatenated with hyphen (-) and the field (e.g.arm32v7-GitCommit). Any architecture that does not have an architecture-specific field will use the default field (e.g. noarm32v7-DirectorymeansDirectorywill be used forarm32v7). See thedebianorubuntufiles in the library for examples. The following is an example forhello-world:See the instruction format section for more information on the format of the library file.
Commitment
Proposing a new official image should not be undertaken lightly. We expect and require a commitment to maintain your image (including and especially timely updates as appropriate, as noted above).
Library definition files
The library definition files are plain text files found in the
library/directory of theofficial-imagesrepository. Each library file controls the current “supported” set of image tags that appear on the Docker Hub description. Tags that are removed from a library file do not get removed from the Docker Hub, so that old versions can continue to be available for use, but are not maintained by upstream or the maintainer of the official image. Tags in the library file are only built through an update to that library file or as a result of its base image being updated (ie, an imageFROM debian:bookwormwould be rebuilt whendebian:bookwormis built). Only what is in the library file will be rebuilt when a base has updates.Given this policy, it is worth clarifying a few cases: backfilled versions, release candidates, and continuous integration builds. When a new repository is proposed, it is common to include some older unsupported versions in the initial pull request with the agreement to remove them right after acceptance. Don’t confuse this with a comprehensive historical archive which is not the intention. Another common case where the term “supported” is stretched a bit is with release candidates. A release candidate is really just a naming convention for what are expected to be shorter-lived releases, so they are totally acceptable and encouraged. Unlike a release candidate, continuous integration builds which have a fully automated release cycle based on code commits or a regular schedule are not appropriate.
It is highly recommended that you browse some of the existing
library/file contents (and history to get a feel for how they change over time) before creating a new one to become familiar with the prevailing conventions and further help streamline the review process (so that we can focus on content instead of esoteric formatting or tag usage/naming).Filenames
The filename of a definition file will determine the name of the image repository it creates on the Docker Hub. For example, the
library/ubuntufile will create tags in theubunturepository.Tags and aliases
The tags of a repository should reflect upstream’s versions or variations. For example, Ubuntu 14.04 is also known as Ubuntu Trusty Tahr, but often as simply Ubuntu Trusty (especially in usage), so
ubuntu:14.04(version number) andubuntu:trusty(version name) are appropriate aliases for the same image contents. In Docker, thelatesttag is a special case, but it’s a bit of a misnomer;latestreally is the “default” tag. When one doesdocker run xyz, Docker interprets that to meandocker run xyz:latest. Given that background, no other tag ever contains the stringlatest, since it’s not something users are expected or encouraged to actually type out (ie,xyz:latestshould really be used as simplyxyz). Put another way, having an alias for the “highest 2.2-series release of XYZ” should bexyz:2.2, notxyz:2.2-latest. Similarly, if there is an Alpine variant ofxyz:latest, it should be aliased asxyz:alpine, notxyz:alpine-latestorxyz:latest-alpine.It is strongly encouraged that version number tags be given aliases which make it easy for the user to stay on the “most recent” release of a particular series. For example, given currently supported XYZ Software versions of 2.3.7 and 2.2.4, suggested aliases would be
Tags: 2.3.7, 2.3, 2, latestandTags: 2.2.4, 2.2, respectively. In this example, the user can usexyz:2.2to easily use the most recent patch release of the 2.2 series, orxyz:2if less granularity is needed (Python is a good example of where that’s most obviously useful –python:2andpython:3are very different, and can be thought of as thelatesttag for each of the major release tracks of Python).As described above,
latestis really “default”, so the image that it is an alias for should reflect which version or variation of the software users should use if they do not know or do not care which version they use. Using Ubuntu as an example,ubuntu:latestpoints to the most recent LTS release, given that it is what the majority of users should be using if they know they want Ubuntu but do not know or care which version (especially considering it will be the most “stable” and well-supported release at any given time).Instruction format
The manifest file format is officially based on RFC 2822, and as such should be familiar to folks who are already familiar with the “headers” of many popular internet protocols/formats such as HTTP or email.
The primary additions are inspired by the way Debian commonly uses 2822 – namely, lines starting with
#are ignored and “entries” are separated by a blank line.The first entry is the “global” metadata for the image. The only required field in the global entry is
Maintainers, whose value is comma-separated in the format ofName <email> (@github)orName (@github). Any field specified in the global entry will be the default for the rest of the entries and can be overridden in an individual entry.Bashbrew will fetch code out of the Git repository (
GitRepo) at the commit specified (GitCommit). If the commit referenced is not available by fetchingmasterof the associatedGitRepo, it becomes necessary to supply a value forGitFetchin order to tell Bashbrew what ref to fetch in order to get the commit necessary.The built image will be tagged as
<manifest-filename>:<tag>(ie,library/golangwith aTagsvalue of1.6, 1, latestwill create tags ofgolang:1.6,golang:1, andgolang:latest).Optionally, if
Directoryis present, Bashbrew will look for theDockerfileinside the specified subdirectory instead of at the root (andDirectorywill be used as the “context” for the build instead of the top-level of the repository). IfFileis present, the specified filename instead ofDockerfilewill be used.See the multi-arch section for details on how to specify a different
GitRepo,GitFetch,GitCommit, orDirectoryfor a specific architecture.Creating a new repository
library/folder. Its name will be the name of your repository on the Hub.Adding a new tag in an existing repository (that you’re the maintainer of)
Change to a tag in an existing repository (that you’re the maintainer of)
Bashbrew
Bashbrew (
bashbrew) is a tool for cloning, building, tagging, and pushing the Docker official images. See the BashbrewREADMEfor more information.