Docker offline installation? Do it right!

Docker can’t run offline

What’s Docker and what’s it for?

Docker offline installation in 4 steps

FROM ubuntu:focal-20201008
ENV DOCKER_VERSION 5:19.03.13~3–0~ubuntu-focal
RUN apt-get update -qqy && \    apt-get install -qqy — no-install-recommends \     apt-transport-https \     ca-certificates \     curl \     gnupg-agent \     software-properties-common && \     apt-get clean -qqy && \     rm -rf /var/cache/apt
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -RUN add-apt-repository \    “deb [arch=amd64] https://download.docker.com/linux/ubuntu \    $(lsb_release -cs) \    stable”
RUN apt-get update -qqy && \     apt-cache madison docker-ce && \     apt-get clean -qqy && \     rm -rf /var/cache/apt
RUN apt-get update -qqy && \    apt-get reinstall -qqy — download-only \      docker-ce=”$DOCKER_VERSION” \      docker-ce-cli=”$DOCKER_VERSION” \      containerd.io \      python3 \      python3-pip \      python-is-python3 && \    mkdir -p /archives && \    mv /var/cache/apt/archives/*.deb /archives/ && \    apt-get clean -qqy && \    rm -rf /var/cache/apt
docker build -t test .docker run \  --rm -it \  -v “$(pwd):/host” \  --entrypoint sh test \  -c ‘rm -rf /host/archives; mv /archives /host’
docker run \  --rm -it \  -v “$(pwd):/host” \  --entrypoint sh test \  -c ‘tar -cpvf /host/archives.tar /archives’
cd artifactssudo dpkg -i *.deb
docker ps -q || sudo systemctl enable --now dockerdocker info

Wrapping things up

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store