commit 3f900a2f75fa4dd2ab05d4a80377518bc2b5f14e Author: len0rd Date: Mon Oct 23 23:47:34 2023 -0400 initial commit diff --git a/01_registry_pull/pull.sh b/01_registry_pull/pull.sh new file mode 100755 index 0000000..add06d6 --- /dev/null +++ b/01_registry_pull/pull.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +docker pull ubuntu:23.04 + +docker image ls | grep ubuntu diff --git a/02_simple_dockerfile/Dockerfile b/02_simple_dockerfile/Dockerfile new file mode 100644 index 0000000..df89917 --- /dev/null +++ b/02_simple_dockerfile/Dockerfile @@ -0,0 +1,8 @@ +FROM ubuntu:22.04 + +RUN apt update +RUN apt install -yq --no-install-recommends \ + # git \ + wget \ + gcc +COPY cool_file.txt / diff --git a/02_simple_dockerfile/build_simple.sh b/02_simple_dockerfile/build_simple.sh new file mode 100755 index 0000000..3ef21ce --- /dev/null +++ b/02_simple_dockerfile/build_simple.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# build the image +docker build -t simple:02 . + +# see the image now exists +docker image ls | grep simple + +# run interactive container of image +# -i = interactive +# -t = allocate a pseudo tty for interactive shell +# --rm remove the container created by this run command after it exits +docker run -it --rm simple:02 /bin/bash + +# alternatively, start the container, print the file, and exit/close the container +# docker run --rm simple:02 cat /cool_file.txt diff --git a/02_simple_dockerfile/cool_file.txt b/02_simple_dockerfile/cool_file.txt new file mode 100644 index 0000000..495cc9f --- /dev/null +++ b/02_simple_dockerfile/cool_file.txt @@ -0,0 +1 @@ +Hello there! diff --git a/03_dockerfile_with_args/Dockerfile b/03_dockerfile_with_args/Dockerfile new file mode 100644 index 0000000..38e699f --- /dev/null +++ b/03_dockerfile_with_args/Dockerfile @@ -0,0 +1,17 @@ +FROM ubuntu:22.04 + +RUN apt update \ + && apt install -yq --no-install-recommends \ + wget \ + tar \ + xz-utils \ + ca-certificates \ + && rm -rf /var/lib/apt/list + +ARG CMAKE_VERSION=3.16.5 +RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.sh \ + -q --no-verbose --show-progress --progress=bar:force:noscroll -O /tmp/cmake-install.sh \ + && chmod u+x /tmp/cmake-install.sh \ + && mkdir /usr/bin/cmake \ + && /tmp/cmake-install.sh --skip-license --prefix=/usr/ \ + && rm /tmp/cmake-install.sh diff --git a/03_dockerfile_with_args/build_with_args.sh b/03_dockerfile_with_args/build_with_args.sh new file mode 100644 index 0000000..5e8cbb1 --- /dev/null +++ b/03_dockerfile_with_args/build_with_args.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# build with CMake version specified in dockerfile +docker build -t with_args:default . +docker run --rm with_args:default cmake --version + +# build with specific CMake version +docker build --build-arg CMAKE_VERSION=3.26.5 -t with_args:3.26 . +docker run --rm with_args:3.26 cmake --version diff --git a/04_multistage_docker_file/multistage_build.sh b/04_multistage_docker_file/multistage_build.sh new file mode 100644 index 0000000..e69de29 diff --git a/05_complex_run_with_compose/complex_with_compose.sh b/05_complex_run_with_compose/complex_with_compose.sh new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md new file mode 100644 index 0000000..ae0fb29 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# docker_demo + +Set of demo examples to demonstrate docker capabilities