How can I install Docker inside an alpine container?

Subit Das picture Subit Das · Jan 8, 2019 · Viewed 15.7k times · Source

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".

Answer

sai anudeep picture sai anudeep · Sep 10, 2019

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