docker_practice/cases/os/alpine.md

70 lines
3.4 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# Alpine
##
![Alpine Linux ](./_images/alpinelinux-logo.png)
`Alpine` `Linux` `Linux` `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` 便
```bash
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
```bash
$ docker run alpine echo '123'
123
```
## `Alpine`
Docker `Alpine`
* `ubuntu/debian` -> `alpine`
* `python:3` -> `python:3-alpine`
* `ruby:2.6` -> `ruby:2.6-alpine`
使 `Alpine` `Ubuntu` `apk` `apt`
```bash
$ apk add --no-cache <package>
```
`Alpine` `https://pkgs.alpinelinux.org/packages` 使
```bash
$ echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
$ apk --update add --no-cache <package>
```
访 `apk` 使 `apk`
```docker
RUN sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories \
&& apk add --no-cache <package>
```
##
* `Alpine` https://www.alpinelinux.org/
* `Alpine` https://github.com/alpinelinux
* `Alpine` https://hub.docker.com/_/alpine/
* `Alpine` https://github.com/gliderlabs/docker-alpine