网站建设 创业,免费自助建站自助建站平台,公司简介模板100字范文,WordPress自己安装了插件Alpine 操作系统是一个面向安全的轻型 Linux 发行版。它不同于通常 Linux 发行版#xff0c;Alpine 采用了 musl libc 和 busybox 以减小系统的体积和运行时资源消耗#xff0c;但功能上比 busybox 又完善的多#xff0c;因此得到开源社区越来越多的青睐。在保持瘦身的同时Alpine 采用了 musl libc 和 busybox 以减小系统的体积和运行时资源消耗但功能上比 busybox 又完善的多因此得到开源社区越来越多的青睐。在保持瘦身的同时Alpine 还提供了自己的包管理工具 apk可以通过 https://pkgs.alpinelinux.org/packages 网站上查询包信息也可以直接通过 apk 命令直接查询和安装各种软件。
Alpine 由非商业组织维护的支持广泛场景的 Linux发行版它特别为资深/重度Linux用户而优化关注安全性能和资源效能。Alpine 镜像可以适用于更多常用场景并且是一个优秀的可以适用于生产的基础系统/环境。
Alpine Docker 镜像也继承了 Alpine Linux 发行版的这些优势。相比于其他 Docker 镜像它的容量非常小仅仅只有 5 MB 左右对比 Ubuntu 系列镜像接近 200 MB且拥有非常友好的包管理机制。官方镜像来自 docker-alpine 项目。
目前 Docker 官方已开始推荐使用 Alpine 替代之前的 Ubuntu 做为基础镜像环境。这样会带来多个好处。包括镜像下载速度加快镜像安全性提高主机之间的切换更方便占用更少磁盘空间等。
下表是官方镜像的大小比较
REPOSITORY TAG IMAGE ID VIRTUAL SIZE alpine latest 4e38e38c8ce0 4.799 MB debian latest 4d6ce913b130 84.98 MB ubuntu latest b39b81afc8ca 188.3 MB centos latest 8efe422e6104 210 MB 获取并使用官方镜像 由于镜像很小下载时间往往很短读者可以直接使用 docker run 指令直接运行一个 Alpine 容器并指定运行的 Linux 指令例如
$ docker run alpine echo 123 123 迁移至 Alpine 基础镜像 目前大部分 Docker 官方镜像都已经支持 Alpine 作为基础镜像可以很容易进行迁移。
例如
ubuntu/debian - alpine python:2.7 - python:2.7-alpine ruby:2.3 - ruby:2.3-alpine 另外如果使用 Alpine 镜像替换 Ubuntu 基础镜像安装软件包时需要用 apk 包管理器替换 apt 工具如
$ apk add --no-cache package Alpine 中软件安装包的名字可能会与其他发行版有所不同可以在 https://pkgs.alpinelinux.org/packages 网站搜索并确定安装包名称。如果需要的安装包不在主索引内但是在测试或社区索引中。那么可以按照以下方法使用这些安装包。
$ echo http://dl-4.alpinelinux.org/alpine/edge/testing /etc/apk/repositories $ apk --update add --no-cache package apk命令详解 / # apk -h apk-tools 2.10.0, compiled for x86_64.
Installing and removing packages: add Add PACKAGEs to world and install (or upgrade) them, while ensuring that all dependencies are met del Remove PACKAGEs from world and uninstall them
System maintenance: fix Repair package or upgrade it without modifying main dependencies update Update repository indexes from all remote repositories upgrade Upgrade currently installed packages to match repositories cache Download missing PACKAGEs to cache and/or delete unneeded files from cache
Querying information about packages: info Give detailed information about PACKAGEs or repositories list List packages by PATTERN and other criteria dot Generate graphviz graphs policy Show repository policy for packages
Repository maintenance: index Create repository index file from FILEs fetch Download PACKAGEs from global repositories to a local directory verify Verify package integrity and signature manifest Show checksums of package contents
Use apk command --help for command-specific help. Use apk --help --verbose for a full command listing.
This apk has coffee making abilities.
相关资源 Alpine 官网http://alpinelinux.org/ Alpine 官方仓库https://github.com/alpinelinux Alpine 官方镜像https://hub.docker.com/_/alpine/ Alpine 官方镜像仓库https://github.com/gliderlabs/docker-alpine