Table of Content

Posts

How can I install Docker inside an alpine container?

Problem

How can I install Docker inside an alpine container and run docker images? I could install, but could not start docker and while running get "docker command not found error".

Solution and Answer

Dockerfile for running docker-cli inside alpine

FROM alpine:3.10
RUN apk add --update docker openrc
RUN rc-update add docker boot

Build docker image

docker build -t docker-alpine .

Run container (host and the alipne container will share the same docker engine)

docker run -it -v "/var/run/docker.sock:/var/run/docker.sock:rw" docker-alpine:latest /bin/sh

Post a Comment