James Percival

My Github Pages material

Last updated : 30th August 2018

A basic Dockerfile


Lets write ourselves a generic Dockerfile using build-args to update an image for apt based distros

ARG DISTRO=ubuntu
ARG BASEIMAGE=xenial
FROM ${DISTRO}:${BASEIMAGE}

# This DockerFile is looked after by
LABEL maintainer "James Percival <me@example.com>"

# Update the system
RUN apt update && apt -y dist-upgrade

You can then build images with e.g.

docker build -t debian-stable --build-arg DISTRO=debian --build-arg BASEIMAGE=stable Dockerfile

and then fire up a root session with

docker run --rm --it debian-stable bash

tags: docker