46 lines
1.5 KiB
Plaintext
46 lines
1.5 KiB
Plaintext
= Usage
|
|
|
|
== Packages
|
|
Replacing your current base image with the Docker Alpine Linux image usually requires updating the package names to the corresponding ones in the https://pkgs.alpinelinux.org[Alpine Linux package index].
|
|
We use the `apk` command to manage packages.
|
|
It works similarly to `apt` and `yum`.
|
|
|
|
For example, installing the `nginx` package would be done by running `apk add --no-cache nginx`.
|
|
The `--no-cache` argument prevents `apk` from caching the package index - something that would normally take up precious space, as well as go stale quickly.
|
|
|
|
=== Example
|
|
This is an example of a complete Dockerfile for `nginx`:
|
|
[source, dockerfile]
|
|
----
|
|
FROM alpine
|
|
|
|
RUN apk --no-cache add nginx
|
|
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"]
|
|
----
|
|
|
|
=== Virtual Packages
|
|
Another great `apk` feature is the concept of user-defined virtual packages.
|
|