美文网首页
alpine 安装 docker、docker compose

alpine 安装 docker、docker compose

作者: 阿基米德来了 | 来源:发表于2019-05-08 16:39 被阅读0次

Docker

Installation

Run apk add docker to install Docker on Alpine Linux.

The Docker package is in the 'Community' repository, so if the apk add fails with unsatisfiable constraints, you need to edit the /etc/apk/repositories file to add (or uncomment) a line like:

http://dl-cdn.alpinelinux.org/alpine/latest-stable/community

then run apk update to index the repository.

To start the Docker daemon at boot, run:

rc-update add docker boot

Then to start the Docker daemon manually, run:

service docker start

**Note: **On older version of Alpine Linux with older version of docker you'll also need to disable some kernel security flags in order to build images:

sysctl -w kernel.grsecurity.chroot_deny_chmod=0

sysctl -w kernel.grsecurity.chroot_deny_mknod=0

Anyway, this weakening of security is not necessary to do with Alpine 3.4.x and Docker 1.12 as of August 2016 anymore.

Docker Compose

To install docker-compose, first install pip:

apk add py-pip

Since docker-compose version 1.24.0, you also need some dev dependencies:

apk add python-dev libffi-dev openssl-dev gcc libc-dev make

Then install docker-compose, run:

pip install docker-compose

Isolate containers with a user namespace

adduser -SDHs /sbin/nologin dockremap
addgroup -S dockremap
echo dockremap:$(cat /etc/passwd|grep dockremap|cut -d: -f3):65536 >> /etc/subuid
echo dockremap:$(cat /etc/passwd|grep dockremap|cut -d: -f4):65536 >> /etc/subgid

and add in /etc/docker/daemon.json

{
        "userns-remap": "dockremap"
}

You may also consider these options : '

       "experimental": false,
       "live-restore": true,
       "ipv6": false,
       "icc": false,
       "no-new-privileges": false

https://wiki.alpinelinux.org/wiki/Docker

相关文章

网友评论

      本文标题:alpine 安装 docker、docker compose

      本文链接:https://www.haomeiwen.com/subject/iikvoqtx.html