跳转至

Docker

安装

  • https://docs.docker.com/engine/install/ubuntu/
  • https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository

构建镜像

在 Dockerfile 中使用包管理器

Debian APT:

apt-get update; \
apt-get install -y --no-install-recommends -o 'Acquire::Retries=3' \
    package1 \
    package2 \
    package3 \
; \
rm -rf /var/lib/apt/lists/*

Alpine APK:

apk update; \
apk add --no-cache \
    package1 \
    package2 \
    package3 \
; \

合并文件层

https://github.com/shinsenter/docker-squash

运行容器

服务状态检查

  • https://docs.docker.com/engine/reference/builder/#healthcheck
  • https://docs.docker.com/compose/compose-file/compose-file-v3/#healthcheck