diff --git a/ASYD_Docker/README.md b/ASYD_Docker/README.md new file mode 100644 index 0000000..76bae7e --- /dev/null +++ b/ASYD_Docker/README.md @@ -0,0 +1,3 @@ +# ASYD_DOCKER + +Git Repository für die Beispiele und Übungen des Docker-Teils von ASYD im FS 2023. diff --git a/ASYD_Docker/docker-01/01-demo/Dockerfile b/ASYD_Docker/docker-01/01-demo/Dockerfile new file mode 100644 index 0000000..c7be2ca --- /dev/null +++ b/ASYD_Docker/docker-01/01-demo/Dockerfile @@ -0,0 +1,37 @@ +# Creates a simple .Net console application, writing second-tick counts to the terminal +# build with: docker build -t REP/IMAGE_NAME:TAG . +# run with: docker run --rm -it IMAGE_NAME +# list intermediate imgs: docker images --filter label=stage=builder + +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder +LABEL stage=builder + +WORKDIR /app +# Copy everything from src-directory on host to workdir in image +COPY src . +# Build and publish a release to directory "out" (build implicitly restores NuGet packages) +RUN dotnet publish -c Release -o out + +# uncomment for testing the build-env image +# CMD ["dotnet", "bin/Release/net7.0/DotnetDocker-01.dll"] + +# Build runtime image +# FROM mcr.microsoft.com/dotnet/aspnet:7.0 +FROM mcr.microsoft.com/dotnet/runtime:7.0 +# create user in the image +RUN groupadd -r mygroup && useradd --no-log-init --create-home --shell /bin/bash -r -g mygroup myuser +# change user +USER myuser +# make app-dir (WORKDIR cmd would create a dir owned by root -> permission denied!) +RUN mkdir /home/myuser/app +# set build- and run-time working directory +WORKDIR /home/myuser/app +COPY --chown=myuser:mygroup --from=builder /app/out . +# Opt-out of the diagnostic pipeline. This allows the container to run as read-only. +ENV COMPlus_EnableDiagnostics=0 +# +# CMD ["dotnet", "ASYD_Demo.dll"] +ENTRYPOINT ["dotnet", "ASYD_Demo.dll"] + + + diff --git a/ASYD_Docker/docker-01/01-demo/build.sh b/ASYD_Docker/docker-01/01-demo/build.sh new file mode 100644 index 0000000..40cbad7 --- /dev/null +++ b/ASYD_Docker/docker-01/01-demo/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash +docker build -t kaohslu/01-demo-img . +docker login +docker image push kaohslu/01-demo-img +echo "to run type: 'docker run --rm kaohslu/01-demo-img'" diff --git a/ASYD_Docker/docker-01/01-demo/src/ASYD_Demo.csproj b/ASYD_Docker/docker-01/01-demo/src/ASYD_Demo.csproj new file mode 100644 index 0000000..120e38c --- /dev/null +++ b/ASYD_Docker/docker-01/01-demo/src/ASYD_Demo.csproj @@ -0,0 +1,8 @@ + + + + Exe + net7.0 + + + diff --git a/ASYD_Docker/docker-01/01-demo/src/Program.cs b/ASYD_Docker/docker-01/01-demo/src/Program.cs new file mode 100644 index 0000000..c130428 --- /dev/null +++ b/ASYD_Docker/docker-01/01-demo/src/Program.cs @@ -0,0 +1,39 @@ +using System; +using System.Threading; + +namespace ASYD_Demo { + internal class Program { + static void Main( string[] args ) { + + if( args.Length >= 1 && args[0] == "--help" ) { + PrintUsageAndExit(); + return; + } + + int a = args.Length >= 1 ? Convert.ToInt32( args[0] ) : -1; + int b = args.Length >= 2 ? Convert.ToInt32( args[1] ) : -1; + if( a > b ) { (a, b) = (b, a); } // swap so that a < b + + int counter = a >= 0 ? a : 1; + int to = b >= 0 ? b : int.MaxValue; + + Console.WriteLine( $"Counting from {counter} to {( to == int.MaxValue ? "2^32" : to )}" ); + + while( counter <= to ) { + Console.WriteLine( $"Counter: {counter++}" ); + if( counter <= to ) + Thread.Sleep( 1000 ); + } + } // end Main() + + public static void PrintUsageAndExit( int err = 0 ) { + Console.WriteLine( System.AppDomain.CurrentDomain.FriendlyName + " [[from] to]" ); + Console.WriteLine( " Counts in 1-second intervals . " + + "If specified, counts from \"from\" to \"to\" and exists, otherwise from 0 to 2^32." ); + System.Environment.Exit( err ); + + } // end Usage() + + } // end Program +} // end namespace + diff --git a/ASYD_Docker/docker-02/123deb/solution.md b/ASYD_Docker/docker-02/123deb/solution.md new file mode 100644 index 0000000..0ad63ff --- /dev/null +++ b/ASYD_Docker/docker-02/123deb/solution.md @@ -0,0 +1,13 @@ +# on host, create named container +```docker run -it --name 123deb debian``` +# in container, create file in /tmp +```echo "hallo ASYD" > /tmp/123.txt``` +# ... and exit from container +```exit``` + +# find the file by name starting in /var/lib/docker/ +```sudo find /var/lib/docker/ -name 123.txt``` +# print the file contents +```sudo cat $(sudo find /var/lib/docker/ -name 123.txt)``` + + diff --git a/ASYD_Docker/docker-02/vol_host/solution.md b/ASYD_Docker/docker-02/vol_host/solution.md new file mode 100644 index 0000000..dfcdc12 --- /dev/null +++ b/ASYD_Docker/docker-02/vol_host/solution.md @@ -0,0 +1,34 @@ + +# on host, first create a directory /user/home/data + +# on host, create a container with a host container in /mydata +```docker run --rm -it -v /home/pi/data/:/mydata debian``` + +# in container, change directory to volume +```cd /mydata``` + +# create the greeting +```echo "hi" > greetings.txt``` +# show created file +```ls -l``` +# output content of created file to console +```cat greetings.txt``` +# exit from container +```exit``` + + +# again on the host, create another container with a named container in /stillmydata +```cd /home/pi/data/``` +# show greetings-file in volume +```cat greetings.txt``` + +# need to change permissions before writing to file +```sudo chmod o+w greeting.txt``` +```echo " bye" >> greetings.txt``` +# exit from container +```cat greetings.txt``` + +# create a new container with a host container in /mydata +```docker run --rm -it -v /home/pi/data/:/stillmydata debian``` +# show greetings-file in volume +```cat /stillmydata/greetings.txt``` diff --git a/ASYD_Docker/docker-02/vol_named/solution.md b/ASYD_Docker/docker-02/vol_named/solution.md new file mode 100644 index 0000000..4b77504 --- /dev/null +++ b/ASYD_Docker/docker-02/vol_named/solution.md @@ -0,0 +1,23 @@ +# on host, create a container with a named container in /mydata +```docker run --rm -it -v myvolume:/mydata debian``` + +# in container, change directory to volume +```cd /mydata``` + +# create the greeting +```echo "hi from $(hostname)" > greetings.txt``` +# show created file +```ls -l``` +# output content of created file to console +```cat greetings.txt``` +# exit from container +```exit``` + + +# again on host, create another container with a named container in /stillmydata +```docker run --rm -it -v myvolume:/stillmydata debian``` +# show greetings-file in volume +```cat /stillmydata/greetings.txt``` +# exit from container +```exit``` + diff --git a/ASYD_Docker/docker-02/webcp/build.sh b/ASYD_Docker/docker-02/webcp/build.sh new file mode 100644 index 0000000..7322a5a --- /dev/null +++ b/ASYD_Docker/docker-02/webcp/build.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# get the container name from the current working directory +CNT_NAME=$(basename $(pwd)) + +echo "starting the nginx-webserver in a container named $IMGAE_NAME" +docker run -it --rm -d -p 8080:80 --name $CNT_NAME nginx + +# tell user what to do :) +echo "okay. now fire up browser and type 'http://$(hostname).simple.eee.intern:8080/' into address bar." +echo "you should see the nginx welcome page." +echo +read -n 1 -p "press any key to copy our web-page to to container." +docker cp index.html $CNT_NAME:/usr/share/nginx/html/ +echo "okay, done" +echo "now reload the page in your browser. you should see our web-page." +echo +read -n 1 -p "when done, press any key to stop (and remove) the webserver container." +docker stop $CNT_NAME +echo "sweet. bye!" diff --git a/ASYD_Docker/docker-02/webcp/index.html b/ASYD_Docker/docker-02/webcp/index.html new file mode 100644 index 0000000..4c6d871 --- /dev/null +++ b/ASYD_Docker/docker-02/webcp/index.html @@ -0,0 +1,8 @@ + + Hello ASYD! +

This is a Heading

+ This is some text. Don't you think Docker rocks?

+ Anyways, you have just copied the file index.html from your host-computer (i.e., your Raspi) into a running container. Splendid! + + + diff --git a/ASYD_Docker/docker-02/webimg/README.txt b/ASYD_Docker/docker-02/webimg/README.txt new file mode 100644 index 0000000..0fd9500 --- /dev/null +++ b/ASYD_Docker/docker-02/webimg/README.txt @@ -0,0 +1,11 @@ + +Creates an Image with a static web-page using docker CLI commands +(not using a Dockerfile) + +- starts a container from the latest nginx image +- copies a static webpage to it using docker cp +- creates an image from the container using docker commit +- starts the newly created image +- cleans up on keypress after telling the user how to view the webpage + + diff --git a/ASYD_Docker/docker-02/webimg/build.sh b/ASYD_Docker/docker-02/webimg/build.sh new file mode 100644 index 0000000..bf047c2 --- /dev/null +++ b/ASYD_Docker/docker-02/webimg/build.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# use the base of the current working directory as the new image name (e.g., "webimg:v1") +IMAGE_NAME=$(basename $(pwd)):v1 + +# creates an image "myweb:v1" by commiting a container. +# start with "./build.sh" in current directory + +# create a random container name and use throuout this scrip +CNTR=$(date | md5sum | head -c 10) + +echo "working with container name '$CNTR'" + +if [ "$(docker ps -q -f name=$CNTR)" ]; then echo "container '$CNTR' exists, exiting"; exit 1; fi + +# create nginx-container named web +docker run -it --rm -d -p 8080:80 --name $CNTR nginx + +# copy static webpage into container +docker cp index.html $CNTR:/usr/share/nginx/html/ + +# commit running container to image +docker commit $CNTR $IMAGE_NAME + +# stop container (which will also delete the container because of --rm ) +docker stop $CNTR + +# start new container from image myweb:v1 and expose port 80 to 8080 on host +docker run -it --rm -d -p 8080:80 --name $CNTR $IMAGE_NAME + +# tell user what to do :) +echo "fire up browser and type 'http://$(hostname).simple.eee.intern:8080/' into address bar" +echo "you should see our webpage" +echo +read -n 1 -p "when done, press any key to stop (and remove) the webserver container." +echo +echo "stopping container $CNTR and cleaning up, hang on...." +docker stop $CNTR + +echo "done. bye then" diff --git a/ASYD_Docker/docker-02/webimg/index.html b/ASYD_Docker/docker-02/webimg/index.html new file mode 100644 index 0000000..91daf1b --- /dev/null +++ b/ASYD_Docker/docker-02/webimg/index.html @@ -0,0 +1,6 @@ + + Hello ASYD! +

This is a Heading

+ This is some text. + + diff --git a/ASYD_Docker/docker-03/chello-world/Dockerfile b/ASYD_Docker/docker-03/chello-world/Dockerfile new file mode 100644 index 0000000..b30839c --- /dev/null +++ b/ASYD_Docker/docker-03/chello-world/Dockerfile @@ -0,0 +1,6 @@ +FROM gcc +WORKDIR /myapp +COPY hello-world.c . +RUN gcc -o hello-world hello-world.c +CMD ["/myapp/hello-world"] + diff --git a/ASYD_Docker/docker-03/chello-world/build.sh b/ASYD_Docker/docker-03/chello-world/build.sh new file mode 100644 index 0000000..562e482 --- /dev/null +++ b/ASYD_Docker/docker-03/chello-world/build.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# get the image name from the current working directory +IMG_NAME=$(basename $(pwd)) +# create a random container name and use throuout this scrip +CNTR=$(date | md5sum | head -c 10) + +docker build -t $IMG_NAME . +echo "starting the container with: 'docker run --rm $IMG_NAME'" + +echo "creating a container with: 'docker create --name $CTNR $IMG_NAME'" +docker create --name $CNTR $IMG_NAME + +echo "copying /myapp from container to host: 'docker cp $CNTR:/myapp/hello-world .'" +docker cp $CNTR:/myapp/hello-world . + +echo "removing the container with: 'docker rm $CTNR'" +docker rm $CNTR + +echo "starting hello-world from the host: './hello-world'" +./hello-world + + +# echo "to start a bash in the container, run: 'docker run --rm -it $IMG_NAME bash'" diff --git a/ASYD_Docker/docker-03/chello-world/hello-world b/ASYD_Docker/docker-03/chello-world/hello-world new file mode 100644 index 0000000..248e5b6 Binary files /dev/null and b/ASYD_Docker/docker-03/chello-world/hello-world differ diff --git a/ASYD_Docker/docker-03/chello-world/hello-world.c b/ASYD_Docker/docker-03/chello-world/hello-world.c new file mode 100644 index 0000000..9b1c165 --- /dev/null +++ b/ASYD_Docker/docker-03/chello-world/hello-world.c @@ -0,0 +1,6 @@ +#include +int main() { + printf("Hello World from within my very own Docker Container :)\n"); + return 0; +} // end main() + diff --git a/ASYD_Docker/docker-03/debcp_v1/Dockerfile b/ASYD_Docker/docker-03/debcp_v1/Dockerfile new file mode 100644 index 0000000..f146072 --- /dev/null +++ b/ASYD_Docker/docker-03/debcp_v1/Dockerfile @@ -0,0 +1,4 @@ +# file Dockerfile +FROM debian +COPY greetings.txt /tmp + diff --git a/ASYD_Docker/docker-03/debcp_v1/build.sh b/ASYD_Docker/docker-03/debcp_v1/build.sh new file mode 100644 index 0000000..da5773c --- /dev/null +++ b/ASYD_Docker/docker-03/debcp_v1/build.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# get the container name from the current working directory +IMG_NAME=$(basename $(pwd)) + +docker build -t $IMG_NAME . + +echo "In the image do:" +echo " cd /tmp" +echo " ls -l" +echo " cat greetings.txt" + + +docker run --rm -it $IMG_NAME + +# can also string together commands to execute at container-start +# docker run --rm -it $IMG_NAME sh -c "cat /tmp/greetings.txt; ls -l /tmp/greetings.txt" + diff --git a/ASYD_Docker/docker-03/debcp_v1/greetings.txt b/ASYD_Docker/docker-03/debcp_v1/greetings.txt new file mode 100644 index 0000000..50dc72a --- /dev/null +++ b/ASYD_Docker/docker-03/debcp_v1/greetings.txt @@ -0,0 +1 @@ +hi there! diff --git a/ASYD_Docker/docker-03/debcp_v2/Dockerfile b/ASYD_Docker/docker-03/debcp_v2/Dockerfile new file mode 100644 index 0000000..61274bd --- /dev/null +++ b/ASYD_Docker/docker-03/debcp_v2/Dockerfile @@ -0,0 +1,3 @@ +# file Dockerfile +FROM debian +RUN echo "hallo ASYD" > /tmp/greetings.txt diff --git a/ASYD_Docker/docker-03/debcp_v2/build.sh b/ASYD_Docker/docker-03/debcp_v2/build.sh new file mode 100644 index 0000000..da5773c --- /dev/null +++ b/ASYD_Docker/docker-03/debcp_v2/build.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# get the container name from the current working directory +IMG_NAME=$(basename $(pwd)) + +docker build -t $IMG_NAME . + +echo "In the image do:" +echo " cd /tmp" +echo " ls -l" +echo " cat greetings.txt" + + +docker run --rm -it $IMG_NAME + +# can also string together commands to execute at container-start +# docker run --rm -it $IMG_NAME sh -c "cat /tmp/greetings.txt; ls -l /tmp/greetings.txt" + diff --git a/ASYD_Docker/docker-03/debcp_v3/Dockerfile b/ASYD_Docker/docker-03/debcp_v3/Dockerfile new file mode 100644 index 0000000..7a17fc6 --- /dev/null +++ b/ASYD_Docker/docker-03/debcp_v3/Dockerfile @@ -0,0 +1,3 @@ +# file Dockerfile +FROM debian +RUN echo "hallo ASYD" > /tmp/greetings.txt && echo "bye, bye" > /tmp/bye.txt diff --git a/ASYD_Docker/docker-03/debcp_v3/build.sh b/ASYD_Docker/docker-03/debcp_v3/build.sh new file mode 100644 index 0000000..da5773c --- /dev/null +++ b/ASYD_Docker/docker-03/debcp_v3/build.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# get the container name from the current working directory +IMG_NAME=$(basename $(pwd)) + +docker build -t $IMG_NAME . + +echo "In the image do:" +echo " cd /tmp" +echo " ls -l" +echo " cat greetings.txt" + + +docker run --rm -it $IMG_NAME + +# can also string together commands to execute at container-start +# docker run --rm -it $IMG_NAME sh -c "cat /tmp/greetings.txt; ls -l /tmp/greetings.txt" + diff --git a/ASYD_Docker/docker-03/debcp_v3/debcp_v2/Dockerfile b/ASYD_Docker/docker-03/debcp_v3/debcp_v2/Dockerfile new file mode 100644 index 0000000..61274bd --- /dev/null +++ b/ASYD_Docker/docker-03/debcp_v3/debcp_v2/Dockerfile @@ -0,0 +1,3 @@ +# file Dockerfile +FROM debian +RUN echo "hallo ASYD" > /tmp/greetings.txt diff --git a/ASYD_Docker/docker-03/debcp_v3/debcp_v2/build.sh b/ASYD_Docker/docker-03/debcp_v3/debcp_v2/build.sh new file mode 100644 index 0000000..da5773c --- /dev/null +++ b/ASYD_Docker/docker-03/debcp_v3/debcp_v2/build.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# get the container name from the current working directory +IMG_NAME=$(basename $(pwd)) + +docker build -t $IMG_NAME . + +echo "In the image do:" +echo " cd /tmp" +echo " ls -l" +echo " cat greetings.txt" + + +docker run --rm -it $IMG_NAME + +# can also string together commands to execute at container-start +# docker run --rm -it $IMG_NAME sh -c "cat /tmp/greetings.txt; ls -l /tmp/greetings.txt" + diff --git a/ASYD_Docker/docker-03/debcp_v4/Dockerfile b/ASYD_Docker/docker-03/debcp_v4/Dockerfile new file mode 100644 index 0000000..e2013b6 --- /dev/null +++ b/ASYD_Docker/docker-03/debcp_v4/Dockerfile @@ -0,0 +1,8 @@ +# file Dockerfile +FROM debian +RUN mkdir /mydata && \ + echo "hi there!" > /mydata/greetings.txt && \ + apt-get update && apt-get install -y nano && apt-get clean && \ + rm -rf /var/lib/apt/lists/* +CMD ["nano", "/mydata/greetings.txt"] + diff --git a/ASYD_Docker/docker-03/debcp_v4/build.sh b/ASYD_Docker/docker-03/debcp_v4/build.sh new file mode 100644 index 0000000..3524d4e --- /dev/null +++ b/ASYD_Docker/docker-03/debcp_v4/build.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# get the container name from the current working directory +IMG_NAME=$(basename $(pwd)) + +docker build -t $IMG_NAME . + +docker run --rm -it $IMG_NAME diff --git a/ASYD_Docker/docker-03/debcp_v4/greetings.txt b/ASYD_Docker/docker-03/debcp_v4/greetings.txt new file mode 100644 index 0000000..50dc72a --- /dev/null +++ b/ASYD_Docker/docker-03/debcp_v4/greetings.txt @@ -0,0 +1 @@ +hi there! diff --git a/ASYD_Docker/docker-03/debcp_v5/Dockerfile b/ASYD_Docker/docker-03/debcp_v5/Dockerfile new file mode 100644 index 0000000..5e440d9 --- /dev/null +++ b/ASYD_Docker/docker-03/debcp_v5/Dockerfile @@ -0,0 +1,6 @@ +# file Dockerfile +FROM debian +WORKDIR /mydata +RUN echo "hi there!" > greetings.txt +# the created file is in /mydata/greetings.txt + diff --git a/ASYD_Docker/docker-03/debcp_v5/build.sh b/ASYD_Docker/docker-03/debcp_v5/build.sh new file mode 100644 index 0000000..ffa482a --- /dev/null +++ b/ASYD_Docker/docker-03/debcp_v5/build.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# get the image name from the current working directory +IMG_NAME=$(basename $(pwd)) + +# create a random container name and use throuout this scrip +CNTR=$(date | md5sum | head -c 10) + + +docker build -t $IMG_NAME . + +# create container without running it +docker create --name $CNTR $IMG_NAME +# copy the file to working directory of the host +docker cp $CNTR:/mydata/greetings.txt . +# remove container again +docker rm $CNTR + +# now list new file +ls -l greetings.txt + diff --git a/ASYD_Docker/docker-03/debcptmp/build.sh b/ASYD_Docker/docker-03/debcptmp/build.sh new file mode 100644 index 0000000..da5773c --- /dev/null +++ b/ASYD_Docker/docker-03/debcptmp/build.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# get the container name from the current working directory +IMG_NAME=$(basename $(pwd)) + +docker build -t $IMG_NAME . + +echo "In the image do:" +echo " cd /tmp" +echo " ls -l" +echo " cat greetings.txt" + + +docker run --rm -it $IMG_NAME + +# can also string together commands to execute at container-start +# docker run --rm -it $IMG_NAME sh -c "cat /tmp/greetings.txt; ls -l /tmp/greetings.txt" + diff --git a/ASYD_Docker/docker-03/debcptmp/context/Dockerfile b/ASYD_Docker/docker-03/debcptmp/context/Dockerfile new file mode 100644 index 0000000..f146072 --- /dev/null +++ b/ASYD_Docker/docker-03/debcptmp/context/Dockerfile @@ -0,0 +1,4 @@ +# file Dockerfile +FROM debian +COPY greetings.txt /tmp + diff --git a/ASYD_Docker/docker-03/debcptmp/context/greetings.txt b/ASYD_Docker/docker-03/debcptmp/context/greetings.txt new file mode 100644 index 0000000..50dc72a --- /dev/null +++ b/ASYD_Docker/docker-03/debcptmp/context/greetings.txt @@ -0,0 +1 @@ +hi there! diff --git a/ASYD_Docker/docker-03/myhelloworld/Dockerfile b/ASYD_Docker/docker-03/myhelloworld/Dockerfile new file mode 100644 index 0000000..f5089f5 --- /dev/null +++ b/ASYD_Docker/docker-03/myhelloworld/Dockerfile @@ -0,0 +1,6 @@ +# Datei Dockerfile +FROM debian +WORKDIR /app +COPY hello-world . +CMD ["/app/hello-world"] + diff --git a/ASYD_Docker/docker-03/myhelloworld/hello-world b/ASYD_Docker/docker-03/myhelloworld/hello-world new file mode 100644 index 0000000..47100e2 Binary files /dev/null and b/ASYD_Docker/docker-03/myhelloworld/hello-world differ diff --git a/ASYD_Docker/docker-03/myweb_v1/README.txt b/ASYD_Docker/docker-03/myweb_v1/README.txt new file mode 100644 index 0000000..0fd9500 --- /dev/null +++ b/ASYD_Docker/docker-03/myweb_v1/README.txt @@ -0,0 +1,11 @@ + +Creates an Image with a static web-page using docker CLI commands +(not using a Dockerfile) + +- starts a container from the latest nginx image +- copies a static webpage to it using docker cp +- creates an image from the container using docker commit +- starts the newly created image +- cleans up on keypress after telling the user how to view the webpage + + diff --git a/ASYD_Docker/docker-03/myweb_v1/build.sh b/ASYD_Docker/docker-03/myweb_v1/build.sh new file mode 100644 index 0000000..5cddf64 --- /dev/null +++ b/ASYD_Docker/docker-03/myweb_v1/build.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# creates an image "myweb:v1" by commiting a container. +# start with "./build.sh" in current directory + +# create a random container name and use throuout this scrip +CNTR=$(date | md5sum | head -c 10) + +echo "working with container name '$CNTR'" + +if [ "$(docker ps -q -f name=$CNTR)" ]; then echo "container '$CNTR' exists, exiting"; exit 1; fi + +# create nginx-container named web +docker run -it --rm -d -p 8080:80 --name $CNTR nginx + +# copy static webpage into container +docker cp index.html $CNTR:/usr/share/nginx/html/ + +# commit running container to image +docker commit $CNTR myweb:v1 + +# stop container (which will also delete the container because of --rm ) +docker stop $CNTR + +# start new container from image myweb:v1 and expose port 80 to 8080 on host +docker run -it --rm -d -p 8080:80 --name $CNTR myweb:v1 + +# tell user what to do :) +echo "fire up browser and type 'http://$(hostname).simple.eee.intern:8080/' into address bar" +read -n 1 -p "when done, press any key to stop (and remove) the webserver container." +echo "stopping container $CNTR and cleaning up, hang on...." +docker stop $CNTR + +echo "done. bye then :)" diff --git a/ASYD_Docker/docker-03/myweb_v1/index.html b/ASYD_Docker/docker-03/myweb_v1/index.html new file mode 100644 index 0000000..91daf1b --- /dev/null +++ b/ASYD_Docker/docker-03/myweb_v1/index.html @@ -0,0 +1,6 @@ + + Hello ASYD! +

This is a Heading

+ This is some text. + + diff --git a/ASYD_Docker/docker-03/myweb_v2/Dockerfile b/ASYD_Docker/docker-03/myweb_v2/Dockerfile new file mode 100644 index 0000000..84d0188 --- /dev/null +++ b/ASYD_Docker/docker-03/myweb_v2/Dockerfile @@ -0,0 +1,5 @@ +# Datei Dockerfile +FROM nginx +COPY index.html /usr/share/nginx/html/ + + diff --git a/ASYD_Docker/docker-03/myweb_v2/build.sh b/ASYD_Docker/docker-03/myweb_v2/build.sh new file mode 100644 index 0000000..8b5fa43 --- /dev/null +++ b/ASYD_Docker/docker-03/myweb_v2/build.sh @@ -0,0 +1,3 @@ +#!/bin/bash +docker build -t myweb:v2 . + diff --git a/ASYD_Docker/docker-03/myweb_v2/index.html b/ASYD_Docker/docker-03/myweb_v2/index.html new file mode 100644 index 0000000..91daf1b --- /dev/null +++ b/ASYD_Docker/docker-03/myweb_v2/index.html @@ -0,0 +1,6 @@ + + Hello ASYD! +

This is a Heading

+ This is some text. + + diff --git a/ASYD_Docker/docker-03/nanodeb_v1/Dockerfile b/ASYD_Docker/docker-03/nanodeb_v1/Dockerfile new file mode 100644 index 0000000..9bedf82 --- /dev/null +++ b/ASYD_Docker/docker-03/nanodeb_v1/Dockerfile @@ -0,0 +1,5 @@ +# Datei Dockerfile +FROM debian +RUN apt-get update +RUN apt-get install -y nano + diff --git a/ASYD_Docker/docker-03/nanodeb_v1/build.sh b/ASYD_Docker/docker-03/nanodeb_v1/build.sh new file mode 100644 index 0000000..bc0adb5 --- /dev/null +++ b/ASYD_Docker/docker-03/nanodeb_v1/build.sh @@ -0,0 +1,3 @@ +#!/bin/bash +docker build -t nanodeb:v1 . + diff --git a/ASYD_Docker/docker-03/nanodeb_v2/Dockerfile b/ASYD_Docker/docker-03/nanodeb_v2/Dockerfile new file mode 100644 index 0000000..8f86151 --- /dev/null +++ b/ASYD_Docker/docker-03/nanodeb_v2/Dockerfile @@ -0,0 +1,7 @@ +# Datei Dockerfile +FROM debian +RUN apt-get update && \ + apt-get install -y nano && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + diff --git a/ASYD_Docker/docker-03/nanodeb_v2/build.sh b/ASYD_Docker/docker-03/nanodeb_v2/build.sh new file mode 100644 index 0000000..553b5da --- /dev/null +++ b/ASYD_Docker/docker-03/nanodeb_v2/build.sh @@ -0,0 +1,3 @@ +#!/bin/bash +docker build -t nanodeb:v2 . + diff --git a/ASYD_Docker/docker-03/nanodeb_v3/Dockerfile b/ASYD_Docker/docker-03/nanodeb_v3/Dockerfile new file mode 100644 index 0000000..841d267 --- /dev/null +++ b/ASYD_Docker/docker-03/nanodeb_v3/Dockerfile @@ -0,0 +1,8 @@ +# Datei Dockerfile +FROM debian +RUN apt-get update && \ + apt-get install -y nano && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* +CMD ["nano", "/greeting.txt"] + diff --git a/ASYD_Docker/docker-03/nanodeb_v3/build.sh b/ASYD_Docker/docker-03/nanodeb_v3/build.sh new file mode 100644 index 0000000..5e33de0 --- /dev/null +++ b/ASYD_Docker/docker-03/nanodeb_v3/build.sh @@ -0,0 +1,3 @@ +#!/bin/bash +docker build -t nanodeb:v3 . + diff --git a/ASYD_Docker/docker-03/nanodeb_v4/Dockerfile b/ASYD_Docker/docker-03/nanodeb_v4/Dockerfile new file mode 100644 index 0000000..b14b4ba --- /dev/null +++ b/ASYD_Docker/docker-03/nanodeb_v4/Dockerfile @@ -0,0 +1,9 @@ +# Datei Dockerfile +FROM debian +RUN apt-get update && \ + apt-get install -y nano && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* +ENTRYPOINT ["nano"] +CMD ["/greeting.txt"] + diff --git a/ASYD_Docker/docker-03/nanodeb_v4/build.sh b/ASYD_Docker/docker-03/nanodeb_v4/build.sh new file mode 100644 index 0000000..1b85876 --- /dev/null +++ b/ASYD_Docker/docker-03/nanodeb_v4/build.sh @@ -0,0 +1,3 @@ +#!/bin/bash +docker build -t nanodeb:v4 . + diff --git a/ASYD_Docker/docker-03/nanodeb_v5/Dockerfile b/ASYD_Docker/docker-03/nanodeb_v5/Dockerfile new file mode 100644 index 0000000..9f9e035 --- /dev/null +++ b/ASYD_Docker/docker-03/nanodeb_v5/Dockerfile @@ -0,0 +1,10 @@ +# Datei Dockerfile +FROM debian +RUN apt-get update && \ + apt-get install -y nano && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* +WORKDIR /app +ENTRYPOINT ["nano"] +CMD ["/greeting.txt"] + diff --git a/ASYD_Docker/docker-03/nanodeb_v5/build.sh b/ASYD_Docker/docker-03/nanodeb_v5/build.sh new file mode 100644 index 0000000..a5ae4ec --- /dev/null +++ b/ASYD_Docker/docker-03/nanodeb_v5/build.sh @@ -0,0 +1,3 @@ +#!/bin/bash +docker build -t nanodeb:v5 . + diff --git a/ASYD_Docker/docker-03/scratch/Dockerfile b/ASYD_Docker/docker-03/scratch/Dockerfile new file mode 100644 index 0000000..e59cea1 --- /dev/null +++ b/ASYD_Docker/docker-03/scratch/Dockerfile @@ -0,0 +1,4 @@ +FROM scratch +COPY hello-world2 / +CMD ["/hello-world2"] + diff --git a/ASYD_Docker/docker-03/scratch/build.sh b/ASYD_Docker/docker-03/scratch/build.sh new file mode 100644 index 0000000..72995ed --- /dev/null +++ b/ASYD_Docker/docker-03/scratch/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash +docker build -t myscratch . + +echo "running with: 'docker run --rm myscratch'" +docker run --rm myscratch diff --git a/ASYD_Docker/docker-03/scratch/hello-world1 b/ASYD_Docker/docker-03/scratch/hello-world1 new file mode 100644 index 0000000..47100e2 Binary files /dev/null and b/ASYD_Docker/docker-03/scratch/hello-world1 differ diff --git a/ASYD_Docker/docker-03/scratch/hello-world2 b/ASYD_Docker/docker-03/scratch/hello-world2 new file mode 100644 index 0000000..da2dee4 Binary files /dev/null and b/ASYD_Docker/docker-03/scratch/hello-world2 differ diff --git a/ASYD_Docker/docker-03/web/build.sh b/ASYD_Docker/docker-03/web/build.sh new file mode 100644 index 0000000..026bc7e --- /dev/null +++ b/ASYD_Docker/docker-03/web/build.sh @@ -0,0 +1,15 @@ +#!/bin/bash +docker run -it --rm -d -p 8080:80 --name webcp nginx + +# tell user what to do :) +echo "okay, fire up browser and type 'http://$(hostname).simple.eee.intern:8080/' into address bar." +echo "you should see the nginx welcome page." +echo +read -n 1 -p "then press any key to copy our web-page to to container." +docker cp index.html web:/usr/share/nginx/html/ +echo "okay, done" +echo "now reload the page in your browser. you should see our web-page." +echo +read -n 1 -p "when done, press any key to stop (and remove) the webserver container." +docker stop webcp +echo "sweet. bye" diff --git a/ASYD_Docker/docker-03/web/index.html b/ASYD_Docker/docker-03/web/index.html new file mode 100644 index 0000000..91daf1b --- /dev/null +++ b/ASYD_Docker/docker-03/web/index.html @@ -0,0 +1,6 @@ + + Hello ASYD! +

This is a Heading

+ This is some text. + + diff --git a/ASYD_Docker/docker-04/compose/netcat_server/Dockerfile b/ASYD_Docker/docker-04/compose/netcat_server/Dockerfile new file mode 100644 index 0000000..f165238 --- /dev/null +++ b/ASYD_Docker/docker-04/compose/netcat_server/Dockerfile @@ -0,0 +1,10 @@ +# file Dockerfile +FROM debian + +RUN apt-get update && apt-get install -y netcat +WORKDIR /app +COPY start_cmd.sh . +RUN mkfifo /app/netcat_fifo +RUN echo "hi there" +CMD ["/app/start_cmd.sh"] + diff --git a/ASYD_Docker/docker-04/compose/netcat_server/build.sh b/ASYD_Docker/docker-04/compose/netcat_server/build.sh new file mode 100644 index 0000000..928dc71 --- /dev/null +++ b/ASYD_Docker/docker-04/compose/netcat_server/build.sh @@ -0,0 +1,6 @@ +#!/bin/bash +IMAGE_NAME=$(basename $(pwd)) +docker build -t $IMAGE_NAME . +echo +echo "run with: 'docker run --rm -p4321:1234 $IMAGE_NAME'" +echo "on host start: 'nc host.example.com 4321'" diff --git a/ASYD_Docker/docker-04/compose/netcat_server/docker-compose.yml b/ASYD_Docker/docker-04/compose/netcat_server/docker-compose.yml new file mode 100644 index 0000000..e96672b --- /dev/null +++ b/ASYD_Docker/docker-04/compose/netcat_server/docker-compose.yml @@ -0,0 +1,10 @@ +# file docker-compose.yml +version: '3' + +services: + nc-server: + # image: netcat_server + build: . + restart: unless-stopped + ports: + - "4321:1234" diff --git a/ASYD_Docker/docker-04/compose/netcat_server/start_cmd.sh b/ASYD_Docker/docker-04/compose/netcat_server/start_cmd.sh new file mode 100644 index 0000000..78c7fd4 --- /dev/null +++ b/ASYD_Docker/docker-04/compose/netcat_server/start_cmd.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cat /app/netcat_fifo | /bin/sh -i 2>&1 | nc -l 1234 > /app/netcat_fifo + diff --git a/ASYD_Docker/docker-04/compose/nginx-golang/README.md b/ASYD_Docker/docker-04/compose/nginx-golang/README.md new file mode 100644 index 0000000..543a05f --- /dev/null +++ b/ASYD_Docker/docker-04/compose/nginx-golang/README.md @@ -0,0 +1,79 @@ +## Compose sample application +### NGINX proxy with GO backend + +Project structure: +``` +. +├── backend +│   ├── Dockerfile +│   └── main.go +├── docker-compose.yml +├── frontend +│   ├── Dockerfile +│   └── nginx.conf +└── README.md +``` + +[_docker-compose.yaml_](docker-compose.yaml) +``` +services: + frontend: + build: frontend + ports: + - 80:80 + depends_on: + - backend + backend: + build: backend +``` +The compose file defines an application with two services `frontend` and `backend`. +When deploying the application, docker-compose maps port 80 of the frontend service container to the same port of the host as specified in the file. +Make sure port 80 on the host is not already in use. + +## Deploy with docker-compose + +``` +$ docker-compose up -d +Creating network "nginx-golang_default" with the default driver +Building backend +Step 1/7 : FROM golang:1.13 AS build +1.13: Pulling from library/golang +... +Successfully built 4b24f27138cc +Successfully tagged nginx-golang_frontend:latest +WARNING: Image for service frontend was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`. +Creating nginx-golang_backend_1 ... done +Creating nginx-golang_frontend_1 ... done +``` + +## Expected result + +Listing containers must show two containers running and the port mapping as below: +``` +$ docker ps +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +8bd5b0d78e73 nginx-golang_frontend "nginx -g 'daemon of…" 53 seconds ago Up 52 seconds 0.0.0.0:80->80/tcp nginx-golang_frontend_1 +56f929c240a0 nginx-golang_backend "/usr/local/bin/back…" 53 seconds ago Up 53 seconds nginx-golang_backend_1 +``` + +After the application starts, navigate to `http://localhost:80` in your web browser or run: +``` +$ curl localhost:80 + + ## . + ## ## ## == + ## ## ## ## ## === +/"""""""""""""""""\___/ === +{ / ===- +\______ O __/ + \ \ __/ + \____\_______/ + + +Hello from Docker! +``` + +Stop and remove the containers +``` +$ docker-compose down +``` diff --git a/ASYD_Docker/docker-04/compose/nginx-golang/backend/Dockerfile b/ASYD_Docker/docker-04/compose/nginx-golang/backend/Dockerfile new file mode 100644 index 0000000..949f8a3 --- /dev/null +++ b/ASYD_Docker/docker-04/compose/nginx-golang/backend/Dockerfile @@ -0,0 +1,11 @@ +FROM golang:1.13 AS build + +WORKDIR /compose/hello-docker +COPY main.go main.go +RUN CGO_ENABLED=0 go build -o backend main.go + +FROM scratch +COPY --from=build /compose/hello-docker/backend /usr/local/bin/backend +CMD ["/usr/local/bin/backend"] + + diff --git a/ASYD_Docker/docker-04/compose/nginx-golang/backend/main.go b/ASYD_Docker/docker-04/compose/nginx-golang/backend/main.go new file mode 100644 index 0000000..a273432 --- /dev/null +++ b/ASYD_Docker/docker-04/compose/nginx-golang/backend/main.go @@ -0,0 +1,30 @@ +package main + +import ( + "fmt" + "log" + "net/http" +) + +func handler(w http.ResponseWriter, r *http.Request) { + fmt.Println(r.URL.RawQuery) + fmt.Fprintf(w, ` + ## . + ## ## ## == + ## ## ## ## ## === +/"""""""""""""""""\___/ === +{ / ===- +\______ O __/ + \ \ __/ + \____\_______/ + + +Hello from Docker! + +`) +} + +func main() { + http.HandleFunc("/", handler) + log.Fatal(http.ListenAndServe(":80", nil)) +} diff --git a/ASYD_Docker/docker-04/compose/nginx-golang/docker-compose.yml b/ASYD_Docker/docker-04/compose/nginx-golang/docker-compose.yml new file mode 100644 index 0000000..a580242 --- /dev/null +++ b/ASYD_Docker/docker-04/compose/nginx-golang/docker-compose.yml @@ -0,0 +1,9 @@ +services: + frontend: + build: frontend + ports: + - 80:80 + depends_on: + - backend + backend: + build: backend diff --git a/ASYD_Docker/docker-04/compose/nginx-golang/frontend/Dockerfile b/ASYD_Docker/docker-04/compose/nginx-golang/frontend/Dockerfile new file mode 100644 index 0000000..7827fec --- /dev/null +++ b/ASYD_Docker/docker-04/compose/nginx-golang/frontend/Dockerfile @@ -0,0 +1,4 @@ +FROM nginx:alpine +COPY nginx.conf /etc/nginx/conf.d/default.conf + + diff --git a/ASYD_Docker/docker-04/compose/nginx-golang/frontend/nginx.conf b/ASYD_Docker/docker-04/compose/nginx-golang/frontend/nginx.conf new file mode 100644 index 0000000..910b45b --- /dev/null +++ b/ASYD_Docker/docker-04/compose/nginx-golang/frontend/nginx.conf @@ -0,0 +1,6 @@ +server { + listen 80; + location / { + proxy_pass http://backend:80; + } +} \ No newline at end of file diff --git a/ASYD_Docker/docker-04/compose/wordpress-beispiel/docker-compose.yml b/ASYD_Docker/docker-04/compose/wordpress-beispiel/docker-compose.yml new file mode 100644 index 0000000..7ae5558 --- /dev/null +++ b/ASYD_Docker/docker-04/compose/wordpress-beispiel/docker-compose.yml @@ -0,0 +1,32 @@ +# Datei test/docker-compose.yml +version: '3' + +services: + db: + image: mariadb:latest + volumes: + - vol-db:/var/lib/mysql + environment: + MYSQL_RANDOM_ROOT_PASSWORD: 1 + MYSQL_DATABASE: wp + MYSQL_USER: wpuser + MYSQL_PASSWORD: geheim + restart: unless-stopped + + wordpress: + image: wordpress:latest + volumes: + - vol-www:/var/www/html/wp-content + ports: + - "8082:80" + environment: + WORDPRESS_DB_HOST: db:3306 + WORDPRESS_DB_USER: wpuser + WORDPRESS_DB_NAME: wp + WORDPRESS_DB_PASSWORD: geheim + restart: unless-stopped + +volumes: + vol-www: + vol-db: + diff --git a/ASYD_Docker/docker-04/dangling/Dockerfile b/ASYD_Docker/docker-04/dangling/Dockerfile new file mode 100644 index 0000000..af9d5a7 --- /dev/null +++ b/ASYD_Docker/docker-04/dangling/Dockerfile @@ -0,0 +1,3 @@ +# file: Dockerfile +FROM alpine +RUN echo "hallo asyd" diff --git a/ASYD_Docker/docker-04/dangling/Dockerfile.v1 b/ASYD_Docker/docker-04/dangling/Dockerfile.v1 new file mode 100644 index 0000000..eebbc08 --- /dev/null +++ b/ASYD_Docker/docker-04/dangling/Dockerfile.v1 @@ -0,0 +1,4 @@ +FROM alpine + +RUN touch /tmp/xyz.txt + diff --git a/ASYD_Docker/docker-04/dangling/Dockerfile.v2 b/ASYD_Docker/docker-04/dangling/Dockerfile.v2 new file mode 100644 index 0000000..dbb4528 --- /dev/null +++ b/ASYD_Docker/docker-04/dangling/Dockerfile.v2 @@ -0,0 +1,4 @@ +FROM alpine + +RUN echo "hallo asyd" > /tmp/xyz.txt + diff --git a/ASYD_Docker/docker-04/dangling/build.sh b/ASYD_Docker/docker-04/dangling/build.sh new file mode 100644 index 0000000..cb73eba --- /dev/null +++ b/ASYD_Docker/docker-04/dangling/build.sh @@ -0,0 +1,24 @@ +#!/bin/bash +IMAGE_NAME=$(basename $(pwd)) + +echo "***" +echo "*** creating an image from Dockerfile.v1 with name my_alpine" + +docker build . -f Dockerfile.v1 -t $IMAGE_NAME + +echo "***" +echo "***listing all images" +docker image ls + +read -n 1 -p "press any key to create an image with the same name from a slightly changed Dockerfile.v2" + +docker build . -f Dockerfile.v2 -t $IMAGE_NAME + +echo "***" +echo "*** listing all images" +docker image ls + +echo "***" +echo "*** note the 'dangling' image named :" +echo "*** to list only dangling images use: docker images --filter dangling=true" +docker images --filter dangling=true diff --git a/ASYD_Docker/docker-04/ex_00_multistage_alpine_musl/Dockerfile b/ASYD_Docker/docker-04/ex_00_multistage_alpine_musl/Dockerfile new file mode 100644 index 0000000..2ae9886 --- /dev/null +++ b/ASYD_Docker/docker-04/ex_00_multistage_alpine_musl/Dockerfile @@ -0,0 +1,15 @@ +FROM alpine as builder + +# install gcc +RUN apk update && apk add gcc musl-dev + +WORKDIR /app +COPY hello-world.c /app +RUN gcc -o hello-world hello-world.c + +FROM alpine + +WORKDIR /app +COPY --from=builder /app/hello-world /app +CMD ["/app/hello-world"] + diff --git a/ASYD_Docker/docker-04/ex_00_multistage_alpine_musl/build.sh b/ASYD_Docker/docker-04/ex_00_multistage_alpine_musl/build.sh new file mode 100644 index 0000000..d6d64a2 --- /dev/null +++ b/ASYD_Docker/docker-04/ex_00_multistage_alpine_musl/build.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +IMAGE_NAME=$(basename $(pwd)) + +echo "***" +echo "*** building image with: 'docker build . -t $IMAGE_NAME'" + + +docker build . -t $IMAGE_NAME +echo "***" +echo "*** run with: 'docker run --rm $IMAGE_NAME'" diff --git a/ASYD_Docker/docker-04/ex_00_multistage_alpine_musl/hello-world b/ASYD_Docker/docker-04/ex_00_multistage_alpine_musl/hello-world new file mode 100644 index 0000000..5ad1334 Binary files /dev/null and b/ASYD_Docker/docker-04/ex_00_multistage_alpine_musl/hello-world differ diff --git a/ASYD_Docker/docker-04/ex_00_multistage_alpine_musl/hello-world.c b/ASYD_Docker/docker-04/ex_00_multistage_alpine_musl/hello-world.c new file mode 100644 index 0000000..9b1c165 --- /dev/null +++ b/ASYD_Docker/docker-04/ex_00_multistage_alpine_musl/hello-world.c @@ -0,0 +1,6 @@ +#include +int main() { + printf("Hello World from within my very own Docker Container :)\n"); + return 0; +} // end main() + diff --git a/ASYD_Docker/docker-04/ex_01_csharp_interactive/solution.txt b/ASYD_Docker/docker-04/ex_01_csharp_interactive/solution.txt new file mode 100644 index 0000000..87861c0 --- /dev/null +++ b/ASYD_Docker/docker-04/ex_01_csharp_interactive/solution.txt @@ -0,0 +1,13 @@ + + +Start the SDK--container interactively, mounting the current directory as /app in the container +$ docker run --rm -it -v $(pwd):/app mcr.microsoft.com/dotnet/sdk:5.0 + +Change to folder ./app which contains the ./src folder (/app/src) +# cd /app + +Start the build using /app/src as source folder and writing to /app/out +# dotnet publish -c Release -o out src + +That's it, exit +# exit diff --git a/ASYD_Docker/docker-04/ex_01_csharp_interactive/src/ConsoleApp1.csproj b/ASYD_Docker/docker-04/ex_01_csharp_interactive/src/ConsoleApp1.csproj new file mode 100644 index 0000000..120e38c --- /dev/null +++ b/ASYD_Docker/docker-04/ex_01_csharp_interactive/src/ConsoleApp1.csproj @@ -0,0 +1,8 @@ + + + + Exe + net7.0 + + + diff --git a/ASYD_Docker/docker-04/ex_01_csharp_interactive/src/Program.cs b/ASYD_Docker/docker-04/ex_01_csharp_interactive/src/Program.cs new file mode 100644 index 0000000..76e36ae --- /dev/null +++ b/ASYD_Docker/docker-04/ex_01_csharp_interactive/src/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace ConsoleApp1 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/ASYD_Docker/docker-04/ex_02_csharp_singlestage/Dockerfile b/ASYD_Docker/docker-04/ex_02_csharp_singlestage/Dockerfile new file mode 100644 index 0000000..d89f80e --- /dev/null +++ b/ASYD_Docker/docker-04/ex_02_csharp_singlestage/Dockerfile @@ -0,0 +1,11 @@ +# file: Dockerfile +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder + +WORKDIR /app +# Copy everything from src-directory on host to workdir in image + +COPY src . +# Build and publish a release to directory "out" (build implicitly restores NuGet packages) +RUN dotnet publish -c Release -o out + +CMD ["dotnet", "/app/out/ConsoleApp1.dll"] diff --git a/ASYD_Docker/docker-04/ex_02_csharp_singlestage/build.sh b/ASYD_Docker/docker-04/ex_02_csharp_singlestage/build.sh new file mode 100644 index 0000000..fdb5911 --- /dev/null +++ b/ASYD_Docker/docker-04/ex_02_csharp_singlestage/build.sh @@ -0,0 +1,10 @@ +!/bin/bash +IMAGE_NAME=$(basename $(pwd)) + +echo "***" +echo "*** buildig image with: 'docker build . -t $IMAGE_NAME'" +docker build . -t $IMAGE_NAME + +echo "***" +echo "*** start image with: 'docker run --rm -t $IMAGE_NAME'" +docker run --rm -t $IMAGE_NAME diff --git a/ASYD_Docker/docker-04/ex_02_csharp_singlestage/src/ConsoleApp1.csproj b/ASYD_Docker/docker-04/ex_02_csharp_singlestage/src/ConsoleApp1.csproj new file mode 100644 index 0000000..120e38c --- /dev/null +++ b/ASYD_Docker/docker-04/ex_02_csharp_singlestage/src/ConsoleApp1.csproj @@ -0,0 +1,8 @@ + + + + Exe + net7.0 + + + diff --git a/ASYD_Docker/docker-04/ex_02_csharp_singlestage/src/Program.cs b/ASYD_Docker/docker-04/ex_02_csharp_singlestage/src/Program.cs new file mode 100644 index 0000000..76e36ae --- /dev/null +++ b/ASYD_Docker/docker-04/ex_02_csharp_singlestage/src/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace ConsoleApp1 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/ASYD_Docker/docker-04/ex_03_csharp_multistage/Dockerfile b/ASYD_Docker/docker-04/ex_03_csharp_multistage/Dockerfile new file mode 100644 index 0000000..3877197 --- /dev/null +++ b/ASYD_Docker/docker-04/ex_03_csharp_multistage/Dockerfile @@ -0,0 +1,23 @@ +# file: Dockerfile +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder + +WORKDIR /app + +# Copy everything from src-directory on host to workdir in image +COPY src . + +# Build and publish a release to directory "out" (build implicitly restores NuGet packages) +RUN dotnet publish -c Release -o out + +# Build runtime image +FROM mcr.microsoft.com/dotnet/runtime:7.0 + +# install GPIO library (don't clean, need cache :-) +RUN apt-get -y update && apt-get -y install gpiod libgpiod2 libgpiod-dev + +# set build- and run-time working directory +WORKDIR /app + +COPY --from=builder /app/out /app + +CMD ["dotnet", "/app/ConsoleApp1.dll"] diff --git a/ASYD_Docker/docker-04/ex_03_csharp_multistage/build.sh b/ASYD_Docker/docker-04/ex_03_csharp_multistage/build.sh new file mode 100644 index 0000000..b90766d --- /dev/null +++ b/ASYD_Docker/docker-04/ex_03_csharp_multistage/build.sh @@ -0,0 +1,11 @@ +#!/bin/bash +IMAGE_NAME=$(basename $(pwd)) + +echo "***" +echo "*** buildig image with: 'docker build . -t $IMAGE_NAME'" +docker build . -t $IMAGE_NAME + + +echo "***" +echo "*** start image with: 'docker run --rm --device /dev/gpiochip0 $IMAGE_NAME'" +docker run --rm $IMAGE_NAME diff --git a/ASYD_Docker/docker-04/ex_03_csharp_multistage/src/ConsoleApp1.csproj b/ASYD_Docker/docker-04/ex_03_csharp_multistage/src/ConsoleApp1.csproj new file mode 100644 index 0000000..120e38c --- /dev/null +++ b/ASYD_Docker/docker-04/ex_03_csharp_multistage/src/ConsoleApp1.csproj @@ -0,0 +1,8 @@ + + + + Exe + net7.0 + + + diff --git a/ASYD_Docker/docker-04/ex_03_csharp_multistage/src/Program.cs b/ASYD_Docker/docker-04/ex_03_csharp_multistage/src/Program.cs new file mode 100644 index 0000000..76e36ae --- /dev/null +++ b/ASYD_Docker/docker-04/ex_03_csharp_multistage/src/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace ConsoleApp1 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/ASYD_Docker/docker-04/gpiolib_console/Dockerfile b/ASYD_Docker/docker-04/gpiolib_console/Dockerfile new file mode 100644 index 0000000..1094a16 --- /dev/null +++ b/ASYD_Docker/docker-04/gpiolib_console/Dockerfile @@ -0,0 +1,2 @@ +FROM debian +RUN apt-get -y update && apt-get -y install gpiod diff --git a/ASYD_Docker/docker-04/gpiolib_console/build.sh b/ASYD_Docker/docker-04/gpiolib_console/build.sh new file mode 100644 index 0000000..376b319 --- /dev/null +++ b/ASYD_Docker/docker-04/gpiolib_console/build.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +IMAGE_NAME=$(basename $(pwd)) + +echo "***" +echo "*** building image with: 'docker build . -t $IMAGE_NAME'" + +docker build . -t $IMAGE_NAME +echo "***" +echo "*** after starting the image, execute (within the container): 'gpioset 0 20=1' to switch on yellow LED" +echo "*** starting image with: 'docker run --rm -it --device=/dev/gpiochip0 $IMAGE_NAME'" +docker run --rm -it --device=/dev/gpiochip0 $IMAGE_NAME diff --git a/ASYD_Docker/docker-04/gpiolib_csharp/Dockerfile b/ASYD_Docker/docker-04/gpiolib_csharp/Dockerfile new file mode 100644 index 0000000..db9b8eb --- /dev/null +++ b/ASYD_Docker/docker-04/gpiolib_csharp/Dockerfile @@ -0,0 +1,25 @@ +#FROM debian + +# file: Dockerfile +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder + +WORKDIR /app + +# Copy everything from src-directory on host to workdir in image +COPY src . + +# Build and publish a release to directory "out" (build implicitly restores NuGet packages) +RUN dotnet publish -c Release -o out + +# Build runtime image +FROM mcr.microsoft.com/dotnet/runtime:7.0 + +# install GPIO library (don't clean, need cache :-) +RUN apt-get -y update && apt-get -y install gpiod libgpiod2 libgpiod-dev + +# set build- and run-time working directory +WORKDIR /app + +COPY --from=builder /app/out /app + +CMD ["dotnet", "/app/ASYD_JoystickLeds.dll"] diff --git a/ASYD_Docker/docker-04/gpiolib_csharp/build.sh b/ASYD_Docker/docker-04/gpiolib_csharp/build.sh new file mode 100644 index 0000000..2f9c7b1 --- /dev/null +++ b/ASYD_Docker/docker-04/gpiolib_csharp/build.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +IMAGE_NAME=$(basename $(pwd)) + +echo "***" +echo "*** buildig image with: 'docker build . -t $IMAGE_NAME'" +docker build . -t $IMAGE_NAME + + +echo "***" +echo "*** start image with: 'docker run --rm --device /dev/gpiochip0 $IMAGE_NAME'" +docker run --rm -it --device /dev/gpiochip0 $IMAGE_NAME diff --git a/ASYD_Docker/docker-04/gpiolib_csharp/src/ASYD_JoystickLeds.csproj b/ASYD_Docker/docker-04/gpiolib_csharp/src/ASYD_JoystickLeds.csproj new file mode 100644 index 0000000..7685257 --- /dev/null +++ b/ASYD_Docker/docker-04/gpiolib_csharp/src/ASYD_JoystickLeds.csproj @@ -0,0 +1,12 @@ + + + + Exe + net7.0 + + + + + + + diff --git a/ASYD_Docker/docker-04/gpiolib_csharp/src/Joystick.cs b/ASYD_Docker/docker-04/gpiolib_csharp/src/Joystick.cs new file mode 100644 index 0000000..ad3f03f --- /dev/null +++ b/ASYD_Docker/docker-04/gpiolib_csharp/src/Joystick.cs @@ -0,0 +1,55 @@ +using System; +using System.Device.Gpio; +using System.Device.Gpio.Drivers; + + +namespace ASYD_JoystickLeds { + internal class Joystick { + // public event EventHandler JoystickChanged; + + protected int buttonLeft = 6; + protected int buttonRight = 5; + protected int buttonUp = 19; + protected int buttonDown = 13; + protected int buttonCenter = 26; + + private static GpioController Ctrl { get { return Program.Ctrl; } } + private static Joystick joystick = null; + + public static Joystick GetInstance() { + if( joystick == null ) { + joystick = new Joystick(); + } + return joystick; + } + + private Joystick() { + + if( Ctrl == null ) + throw new Exception( "Constructor Joystick needs access to GpioController object." ); + + Console.WriteLine( "in Joystick() - Initializing Pins" ); + Ctrl.OpenPin( buttonLeft, PinMode.Input ); + Ctrl.OpenPin( buttonRight, PinMode.Input ); + Ctrl.OpenPin( buttonUp, PinMode.Input ); + Ctrl.OpenPin( buttonDown, PinMode.Input ); + Ctrl.OpenPin( buttonCenter, PinMode.Input ); + + } // end constructor + + public JoystickButtons State { + get { + JoystickButtons state = JoystickButtons.None; + + // PinValue v = ctrl.Read( buttonLeft ); + if( Ctrl.Read( buttonLeft ) == false ) state |= JoystickButtons.Left; + if( Ctrl.Read( buttonRight ) == false ) state |= JoystickButtons.Right; + if( Ctrl.Read( buttonUp ) == false ) state |= JoystickButtons.Up; + if( Ctrl.Read( buttonDown ) == false ) state |= JoystickButtons.Down; + if( Ctrl.Read( buttonCenter ) == false ) state |= JoystickButtons.Center; + return state; + } + } // property State + + } // end class Joystick +} diff --git a/ASYD_Docker/docker-04/gpiolib_csharp/src/JoystickButtons.cs b/ASYD_Docker/docker-04/gpiolib_csharp/src/JoystickButtons.cs new file mode 100644 index 0000000..442679f --- /dev/null +++ b/ASYD_Docker/docker-04/gpiolib_csharp/src/JoystickButtons.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ASYD_JoystickLeds { + [Flags] + public enum JoystickButtons { + None = 0, + Left = 1, + Right = 2, + Up = 4, + Down = 8, + Center = 16 + } +} diff --git a/ASYD_Docker/docker-04/gpiolib_csharp/src/LedColor.cs b/ASYD_Docker/docker-04/gpiolib_csharp/src/LedColor.cs new file mode 100644 index 0000000..cfc2bd9 --- /dev/null +++ b/ASYD_Docker/docker-04/gpiolib_csharp/src/LedColor.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ASYD_JoystickLeds { + public enum LedColor { + Green, + Yellow, + Red, + Blue + } +} diff --git a/ASYD_Docker/docker-04/gpiolib_csharp/src/Leds.cs b/ASYD_Docker/docker-04/gpiolib_csharp/src/Leds.cs new file mode 100644 index 0000000..29e133c --- /dev/null +++ b/ASYD_Docker/docker-04/gpiolib_csharp/src/Leds.cs @@ -0,0 +1,94 @@ +using System; +using System.Device.Gpio; +using System.Threading; + +namespace ASYD_JoystickLeds { + public class Leds { + + // APROG HAT rev6 // rev7 + int pinLedRed = 21; // 16 + int pinLedYellow = 20; // 20 + int pinLedGreen = 16; // 21 + int pinLedBlue = 12; // n/A - set to one of the others! + + bool stateLedRed = false; // PinValue.Low + bool stateLedYellow = false; + bool stateLedGreen = false; + bool stateLedBlue = false; + + private static GpioController Ctrl { get { return Program.Ctrl; } } + private static Leds leds = null; + public static Leds GetInstance() { + if( leds == null ) { + leds = new Leds(); + } + return leds; + } + + private Leds() { + + if( Ctrl == null ) + throw new Exception( "Constructor Leds needs access to GpioController object." ); + + // set GPIO to output mode + Ctrl.OpenPin( pinLedRed, PinMode.Output ); + Ctrl.OpenPin( pinLedYellow, PinMode.Output ); + Ctrl.OpenPin( pinLedGreen, PinMode.Output ); + Ctrl.OpenPin( pinLedBlue, PinMode.Output ); + + // breifly flash Leds: switch all Leds on + Ctrl.Write( pinLedRed, PinValue.High ); + Ctrl.Write( pinLedYellow, PinValue.High ); + Ctrl.Write( pinLedGreen, PinValue.High ); + Ctrl.Write( pinLedBlue, PinValue.High ); + Thread.Sleep( 50 ); + // switch all Leds off + Ctrl.Write( pinLedRed, PinValue.Low ); + Ctrl.Write( pinLedYellow, PinValue.Low ); + Ctrl.Write( pinLedGreen, PinValue.Low ); + Ctrl.Write( pinLedBlue, PinValue.Low ); + + } // end constructor + + public bool Get( LedColor color ) { + // horrible spaghetti code!help me fix it!;) + switch( color ) { + case LedColor.Red: + return stateLedRed; + case LedColor.Yellow: + return stateLedYellow; + case LedColor.Green: + return stateLedGreen; + case LedColor.Blue: + return stateLedBlue; + default: + throw new NotImplementedException( "Unknown LedColor " + color ); + } + } + public void Set( LedColor color, bool state ) { + // horrible spaghetti code! help me fix it! ;) + switch( color ) { + case LedColor.Red: + stateLedRed = state; + Ctrl.Write( pinLedRed, (PinValue)stateLedRed ); + break; + case LedColor.Yellow: + stateLedYellow = state; + Ctrl.Write( pinLedYellow, (PinValue)stateLedYellow ); + break; + case LedColor.Green: + stateLedGreen = state; + Ctrl.Write( pinLedGreen, (PinValue)stateLedGreen ); + break; + case LedColor.Blue: + stateLedBlue = state; + Ctrl.Write( pinLedBlue, (PinValue)stateLedBlue ); + break; + default: + throw new NotImplementedException( "Unknown LedColor " + color ); + } + } // end Set() + + + } // end class Leds +} // end namespace diff --git a/ASYD_Docker/docker-04/gpiolib_csharp/src/Program.cs b/ASYD_Docker/docker-04/gpiolib_csharp/src/Program.cs new file mode 100644 index 0000000..9971ec7 --- /dev/null +++ b/ASYD_Docker/docker-04/gpiolib_csharp/src/Program.cs @@ -0,0 +1,53 @@ +using System; +using System.Threading; +using System.Device.Gpio; +using System.Device.Gpio.Drivers; + +namespace ASYD_JoystickLeds { + + internal class Program { + public static GpioController Ctrl { get; set; } + + static void Main( string[] args ) { + Console.WriteLine( "Hello World!" ); + + // Set up GPIO + + int gpioBank = 0; + Console.WriteLine( "in Joystick() - create LibGpiodDriver" ); + LibGpiodDriver libGpiodDriver = new LibGpiodDriver( gpioBank ); + + Console.WriteLine( "in Joystick() - create GpioController" ); + GpioController ctrl = new GpioController( PinNumberingScheme.Logical, libGpiodDriver ); + Ctrl = ctrl; // set in public property so joystick and leds can access it + + Thread t = new Thread( Run ); + // Background thread, ends when Main() ends + t.IsBackground = false; + t.Start(); + // Program ends, but Run-Thread keeps working + } + protected static void Run() { + Joystick joystick = Joystick.GetInstance(); + + Leds leds = Leds.GetInstance(); + + JoystickButtons oldState = JoystickButtons.None; + JoystickButtons newState; + while( true ) { + newState = joystick.State; + if( oldState != newState ) { + Console.WriteLine( newState ); + + leds.Set( LedColor.Green, (newState & JoystickButtons.Up) > 0 ); + leds.Set( LedColor.Yellow, ( newState & JoystickButtons.Down ) > 0 ); + leds.Set( LedColor.Red, ( newState & JoystickButtons.Left ) > 0 ); + leds.Set( LedColor.Blue, ( newState & JoystickButtons.Right ) > 0 ); + oldState = newState; + } + Thread.Sleep( 50 ); + } + } // end Run() + } // end class Program + +} // end namespace diff --git a/ASYD_Docker/docker-04/multistage_alpine/Dockerfile b/ASYD_Docker/docker-04/multistage_alpine/Dockerfile new file mode 100644 index 0000000..8fb1da0 --- /dev/null +++ b/ASYD_Docker/docker-04/multistage_alpine/Dockerfile @@ -0,0 +1,12 @@ +FROM gcc as builder + +WORKDIR /myapp +COPY hello-world.c /myapp +RUN gcc -static -o hello-world hello-world.c + +FROM alpine + +WORKDIR /myapp +COPY --from=builder /myapp/hello-world /myapp +CMD ["/myapp/hello-world"] + diff --git a/ASYD_Docker/docker-04/multistage_alpine/build.sh b/ASYD_Docker/docker-04/multistage_alpine/build.sh new file mode 100644 index 0000000..70ddb9b --- /dev/null +++ b/ASYD_Docker/docker-04/multistage_alpine/build.sh @@ -0,0 +1,9 @@ +#!/bin/bash +IMAGE_NAME=$(basename $(pwd)) + +echo "***" +echo "*** buildig image with: 'docker build . -t $IMAGE_NAME'" +docker build . -t $IMAGE_NAME + +echo "***" +echo "*** run with: 'docker run --rm $IMAGE_NAME'" diff --git a/ASYD_Docker/docker-04/multistage_alpine/hello-world.c b/ASYD_Docker/docker-04/multistage_alpine/hello-world.c new file mode 100644 index 0000000..9b1c165 --- /dev/null +++ b/ASYD_Docker/docker-04/multistage_alpine/hello-world.c @@ -0,0 +1,6 @@ +#include +int main() { + printf("Hello World from within my very own Docker Container :)\n"); + return 0; +} // end main() + diff --git a/ASYD_Docker/docker-04/multistage_debian/Dockerfile b/ASYD_Docker/docker-04/multistage_debian/Dockerfile new file mode 100644 index 0000000..602ecbd --- /dev/null +++ b/ASYD_Docker/docker-04/multistage_debian/Dockerfile @@ -0,0 +1,13 @@ +# file Dockerfile +FROM gcc as builder + +WORKDIR /myapp +COPY hello-world.c /myapp +RUN gcc -o hello-world hello-world.c + +FROM debian + +WORKDIR /myapp +COPY --from=builder /myapp/hello-world /myapp +CMD ["/myapp/hello-world"] + diff --git a/ASYD_Docker/docker-04/multistage_debian/build.sh b/ASYD_Docker/docker-04/multistage_debian/build.sh new file mode 100644 index 0000000..c49f05e --- /dev/null +++ b/ASYD_Docker/docker-04/multistage_debian/build.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +IMAGE_NAME=$(basename $(pwd)) + +echo "***" +echo "*** building image with: 'docker build . -t $IMAGE_NAME'" +docker build . -t $IMAGE_NAME + +echo "***" +echo "*** now run the image with: 'docker run --rm $IMAGE_NAME'" diff --git a/ASYD_Docker/docker-04/multistage_debian/hello-world.c b/ASYD_Docker/docker-04/multistage_debian/hello-world.c new file mode 100644 index 0000000..9b1c165 --- /dev/null +++ b/ASYD_Docker/docker-04/multistage_debian/hello-world.c @@ -0,0 +1,6 @@ +#include +int main() { + printf("Hello World from within my very own Docker Container :)\n"); + return 0; +} // end main() + diff --git a/ASYD_Docker/docker-04/multistage_scratch/Dockerfile b/ASYD_Docker/docker-04/multistage_scratch/Dockerfile new file mode 100644 index 0000000..e348c23 --- /dev/null +++ b/ASYD_Docker/docker-04/multistage_scratch/Dockerfile @@ -0,0 +1,12 @@ +# file: Dockerfile + +FROM gcc as builder + +WORKDIR /myapp +COPY hello-world.c /myapp +RUN gcc -static -o hello-world hello-world.c + +FROM scratch +COPY --from=builder /myapp/hello-world / +CMD ["/hello-world"] + diff --git a/ASYD_Docker/docker-04/multistage_scratch/build.sh b/ASYD_Docker/docker-04/multistage_scratch/build.sh new file mode 100644 index 0000000..cae6731 --- /dev/null +++ b/ASYD_Docker/docker-04/multistage_scratch/build.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +IMAGE_NAME=$(basename $(pwd)) + +echo "***" +echo "*** building image with: 'docker build . -t $IMAGE_NAME'" +docker build . -t $IMAGE_NAME + +echo "***" +echo "*** now run with: 'docker run --rm $IMAGE_NAME'" diff --git a/ASYD_Docker/docker-04/multistage_scratch/hello-world.c b/ASYD_Docker/docker-04/multistage_scratch/hello-world.c new file mode 100644 index 0000000..9b1c165 --- /dev/null +++ b/ASYD_Docker/docker-04/multistage_scratch/hello-world.c @@ -0,0 +1,6 @@ +#include +int main() { + printf("Hello World from within my very own Docker Container :)\n"); + return 0; +} // end main() + diff --git a/ASYD_Docker/docker-04/singlestage_gcc/Dockerfile.dynamic b/ASYD_Docker/docker-04/singlestage_gcc/Dockerfile.dynamic new file mode 100644 index 0000000..19b276a --- /dev/null +++ b/ASYD_Docker/docker-04/singlestage_gcc/Dockerfile.dynamic @@ -0,0 +1,7 @@ +FROM gcc +WORKDIR /app +COPY hello-world.c /app +# bind hello-world dynamically +RUN gcc -o hello-world hello-world.c +CMD ["/app/hello-world"] + diff --git a/ASYD_Docker/docker-04/singlestage_gcc/Dockerfile.static b/ASYD_Docker/docker-04/singlestage_gcc/Dockerfile.static new file mode 100644 index 0000000..e5c8364 --- /dev/null +++ b/ASYD_Docker/docker-04/singlestage_gcc/Dockerfile.static @@ -0,0 +1,7 @@ +FROM gcc +WORKDIR /app +COPY hello-world.c /app +# bind hello-world statically +RUN gcc -static -o hello-world hello-world.c +CMD ["/app/hello-world"] + diff --git a/ASYD_Docker/docker-04/singlestage_gcc/build.sh b/ASYD_Docker/docker-04/singlestage_gcc/build.sh new file mode 100644 index 0000000..744203d --- /dev/null +++ b/ASYD_Docker/docker-04/singlestage_gcc/build.sh @@ -0,0 +1,7 @@ +#!/bin/bash +IMAGE_NAME=$(basename $(pwd)) +docker build -t $IMAGE_NAME.static -f Dockerfile.static . +docker build -t $IMAGE_NAME.dynamic -f Dockerfile.dynamic . +echo +echo "run 'static' image with: 'docker run --rm $IMAGE_NAME.static'" +echo "run 'dynamic' image with: 'docker run --rm $IMAGE_NAME.dynamic'" diff --git a/ASYD_Docker/docker-04/singlestage_gcc/hello-world.c b/ASYD_Docker/docker-04/singlestage_gcc/hello-world.c new file mode 100644 index 0000000..9b1c165 --- /dev/null +++ b/ASYD_Docker/docker-04/singlestage_gcc/hello-world.c @@ -0,0 +1,6 @@ +#include +int main() { + printf("Hello World from within my very own Docker Container :)\n"); + return 0; +} // end main() +