docker_practice/cases/os/alpine.md

70 lines
3.4 KiB
Go
Raw Normal View History

# Alpine
2017-05-24 11:22:23 +08:00
##
2017-05-24 11:22:23 +08:00
![Apline 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`
2017-05-24 11:22:23 +08:00
Docker 使 `Alpine` `Ubuntu` 便
2017-12-01 23:23:26 +08:00
```bash
2017-05-24 11:22:23 +08:00
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
```
## 使
2017-05-24 11:22:23 +08:00
使 `docker run` `Alpine` Linux
2017-12-01 23:23:26 +08:00
```bash
2017-05-24 11:22:23 +08:00
$ docker run alpine echo '123'
123
```
## `Alpine`
2017-05-24 11:22:23 +08:00
Docker `Alpine`
2017-05-24 11:22:23 +08:00
* `ubuntu/debian` -> `alpine`
* `python:3` -> `python:3-alpine`
* `ruby:2.6` -> `ruby:2.6-alpine`
2017-05-24 11:22:23 +08:00
使 `Alpine` `Ubuntu` `apk` `apt`
2017-05-24 11:22:23 +08:00
2017-12-01 23:23:26 +08:00
```bash
2017-05-24 11:22:23 +08:00
$ apk add --no-cache <package>
```
`Alpine` `https://pkgs.alpinelinux.org/packages` 使
2017-12-01 23:23:26 +08:00
```bash
$ echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
2017-05-24 11:22:23 +08:00
$ 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>
```
##
2017-05-24 11:22:23 +08:00
2019-01-06 10:15:13 +08:00
* `Alpine` https://www.alpinelinux.org/
2017-12-01 23:23:26 +08:00
* `Alpine` https://github.com/alpinelinux
* `Alpine` https://hub.docker.com/_/alpine/
* `Alpine` https://github.com/gliderlabs/docker-alpine