open terminal in Ubuntu
Note: I'm using Ubuntu 18
create any working folder somewhere, and cd to that folder, e.g. abc
mkdir abc && cd abc
intialize a git local git repo for source tracking (use at own discretion)
Note: Install git before running this command https://git-scm.com/downloads
git init
create folder alpine3.11.3 it will contain the Dockerfile and host/guest folder called shared, where
mkdir alpine3.11.3
mkdir alpine3.11.3/shared
create alpine3.11.3/Dockerfile:
FROM alpine:3.11.3
LABEL maintainer="phpnix+docker@code-sharp.com"
LABEL comment="base os alpine:3.11.3"
build the alpine3.11.3/Dockerfile (from parent folder) tag it alpinebase
Note: This requires Docker https://docs.docker.com/install/
docker build -t alpinebase alpine3.11.3/.
run and open shell repl in docker image
docker run -it alpinebase
verify the distro is alpine
/ # cat /etc/*-release
[Output]
3.11.3
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.11.3
PRETTY_NAME="Alpine Linux v3.11"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"
list the files in the docker instance, redirect to shared/files.txt
docker run alpinebase ls -lR > ./alpine3.11.3/shared/files.txt
the result is a file of files in host/guest shared folder
head ./alpine3.11.3/shared/files.txt
.:
total 56
drwxr-xr-x 2 root root 4096 Jan 16 21:52 bin
drwxr-xr-x 5 root root 340 Feb 29 15:36 dev
drwxr-xr-x 1 root root 4096 Feb 29 15:36 etc
drwxr-xr-x 2 root root 4096 Jan 16 21:52 home
drwxr-xr-x 5 root root 4096 Jan 16 21:52 lib
drwxr-xr-x 5 root root 4096 Jan 16 21:52 media
drwxr-xr-x 2 root root 4096 Jan 16 21:52 mnt
drwxr-xr-x 2 root root 4096 Jan 16 21:52 opt
clone the docker file for upgrading
cp alpine3.11.3 alpine3.11.3.up
edit alpine3.11.3.up/Dockerfile, add the update upgrade:
FROM alpine:3.11.3
LABEL maintainer="phpnix+docker@code-sharp.com"
LABEL comment="base alpine:3.11.3 w update upgrade"
RUN apk --update add \
&& apk upgrade \
&& rm /var/cache/apk/*
build new image with update upgrade tag it alpineup
docker build -t alpineup alpine3.11.3.up/.
list the files in the docker instance, redirect to shared/files.txt
docker run alpineup ls -lR > ./alpine3.11.3.up/shared/files.txt
compare the files from the plain to the updated, using colorized output
diff --color ./alpine3.11.3.up/shared/files.txt ./alpine3.11.3/shared/files.txt