mirror of
https://github.com/jpetazzo/container.training.git
synced 2026-07-18 12:29:18 +00:00
Reorg TOC to match class; added alias+refs; added exploring-images
This commit is contained in:
27
slides/containers/Understanding_Images.md
Normal file
27
slides/containers/Understanding_Images.md
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
|
||||
```bash
|
||||
$ docker run -it debian
|
||||
root@ef22f9437171:/# apt-get update
|
||||
|
||||
root@ef22f9437171:/# apt-get install skopeo
|
||||
|
||||
root@ef22f9437171:/# apt-get wget curl jq
|
||||
|
||||
root@ef22f9437171:/# skopeo login docker.io -u containertraining -p testaccount
|
||||
|
||||
$ docker commit $(docker ps -lq) skop
|
||||
```
|
||||
|
||||
```bash
|
||||
root@0ab665194c4f:~# skopeo copy docker://docker.io/containertraining/test-image-0 dir:/root/test-image-0
|
||||
root@0ab665194c4f:~# cd /root/test-image-0
|
||||
root@0ab665194c4f:~# jq <manifest.json .layers[].digest
|
||||
```
|
||||
|
||||
|
||||
Stuff in Exploring-images
|
||||
image-test-0/1/2 + jpg
|
||||
|
||||
|
||||
|
||||
20
slides/containers/exploring-images/Dockerfile.test-image-0
Normal file
20
slides/containers/exploring-images/Dockerfile.test-image-0
Normal file
@@ -0,0 +1,20 @@
|
||||
FROM busybox
|
||||
|
||||
ADD verifyImageFiles.sh /
|
||||
|
||||
WORKDIR /play
|
||||
|
||||
RUN echo "== LAYER 0 ==" && \
|
||||
echo "A is for Aardvark" >A && \
|
||||
echo "B is for Beetle" >B && \
|
||||
mkdir C/ && \
|
||||
echo "A is for Cowboy Allan" >C/CA && \
|
||||
mkdir -p C/CB && \
|
||||
echo "A is for Cowboy Buffalo Alex" >C/CB/CBA && \
|
||||
echo "B is for Cowboy Buffalo Bill" >C/CB/CBB && \
|
||||
echo "Z is for Cowboy Zeke" >> C/CZ && \
|
||||
mkdir D/ && \
|
||||
echo "A is for Detective Alisha" >D/DA && \
|
||||
echo "B is for Detective Betty" >D/DB && \
|
||||
echo "E is for Elephant" >E && \
|
||||
find . >../state.layer-0
|
||||
17
slides/containers/exploring-images/Dockerfile.test-image-1
Normal file
17
slides/containers/exploring-images/Dockerfile.test-image-1
Normal file
@@ -0,0 +1,17 @@
|
||||
FROM test-image-0
|
||||
|
||||
WORKDIR /play
|
||||
|
||||
RUN echo "== LAYER 1 == Change File B, Create File C/CC, Add Dir C/CD, Remove File E, Create Dir F, Add File G, Create Empty Dir H" && \
|
||||
echo "B is for Butterfly" >B && \
|
||||
echo "C is for Cowboy Chuck">C/CC && \
|
||||
mkdir -p C/CD && \
|
||||
echo "A is for Cowboy Dandy Austin" >C/CD/CDA && \
|
||||
rm E && \
|
||||
mkdir F && \
|
||||
echo "A is for Ferret Albert" >F/FA && \
|
||||
echo "G is for Gorilla" >G && \
|
||||
mkdir H && \
|
||||
find . >../state.layer-1
|
||||
|
||||
|
||||
18
slides/containers/exploring-images/Dockerfile.test-image-2
Normal file
18
slides/containers/exploring-images/Dockerfile.test-image-2
Normal file
@@ -0,0 +1,18 @@
|
||||
FROM test-image-1
|
||||
|
||||
WORKDIR /play
|
||||
|
||||
RUN echo "== LAYER 2 == Remove File C/CA, Remove Dir G, Remove Dir D / Replace with new Dir D, Remove Dir C/CB, Remove Dir C/CB, Remove Dir F, Add File G, Remove Dir H / Create File H" && \
|
||||
rm C/CA && \
|
||||
rm -rf C/CB && \
|
||||
echo "Z is for Cowboy Zoe" >> CZ && \
|
||||
rm -rf D && \
|
||||
mkdir -p D && \
|
||||
echo "A is for Duplicitous Albatros" >D/DA && \
|
||||
rm -rf F && \
|
||||
rm G && \
|
||||
echo "G is for Geccos" >G && \
|
||||
rmdir H \
|
||||
echo "H is for Human" >H && \
|
||||
find . >../state.layer-2
|
||||
|
||||
87
slides/containers/exploring-images/testplan.sh
Executable file
87
slides/containers/exploring-images/testplan.sh
Executable file
@@ -0,0 +1,87 @@
|
||||
clear
|
||||
|
||||
baseDir=$(pwd)
|
||||
|
||||
rm -rf /tmp/exploringImags
|
||||
|
||||
mkdir -p /tmp/exploringImags
|
||||
|
||||
cd /tmp/exploringImags
|
||||
|
||||
|
||||
echo "== LAYER 0 =="
|
||||
|
||||
echo "A is for Aardvark" >A
|
||||
echo "B is for Beetle" >B
|
||||
|
||||
mkdir C/
|
||||
echo "A is for Cowboy Allan" >C/CA
|
||||
|
||||
mkdir -p C/CB
|
||||
echo "A is for Cowboy Buffalo Alex" >C/CB/CBA
|
||||
echo "B is for Cowboy Buffalo Bill" >C/CB/CBB
|
||||
|
||||
echo "Z is for Cowboy Zeke" >C/CZ
|
||||
|
||||
mkdir D/
|
||||
echo "A is for Detective Alisha" >D/DA
|
||||
echo "B is for Detective Betty" >D/DB
|
||||
|
||||
echo "E is for Elephant" >E
|
||||
|
||||
find . >../state.layer-0
|
||||
tree | grep -v directories | tee ../tree.layer-0
|
||||
|
||||
$baseDir/verifyImageFiles.sh 0 $(pwd)
|
||||
|
||||
|
||||
echo "== LAYER 1 == Change File B, Create File C/CC, Add Dir C/CD, Remove File E, Create Dir F, Add File G, Create Empty Dir H"
|
||||
|
||||
echo "B is for Butterfly" >B
|
||||
|
||||
echo "C is for Cowboy Chuck">C/CC
|
||||
|
||||
mkdir -p C/CD
|
||||
echo "A is for Cowboy Dandy Austin" >C/CD/CDA
|
||||
|
||||
rm E
|
||||
|
||||
mkdir F
|
||||
echo "A is for Ferret Albert" >F/FA
|
||||
|
||||
echo "G is for Gorilla" >G
|
||||
|
||||
mkdir H
|
||||
|
||||
find . >../state.layer-1
|
||||
tree | grep -v directories | tee ../tree.layer-1
|
||||
|
||||
$baseDir/verifyImageFiles.sh 1 $(pwd)
|
||||
|
||||
|
||||
echo "== LAYER 2 == Remove File C/CA, Remove Dir G, Remove Dir D Replace with new Dir D, Remove Dir C/CB, Remove Dir C/CB, Add File H/HA, Add File, Create Dir I"
|
||||
|
||||
rm C/CA
|
||||
|
||||
rm -rf C/CB
|
||||
|
||||
echo "Z is for Cowboy Zoe" >C/CZ
|
||||
|
||||
rm -rf D
|
||||
mkdir -p D
|
||||
echo "A is for Duplicitous Albatros" >D/DA
|
||||
|
||||
rm -rf F
|
||||
|
||||
rm -rf G
|
||||
echo "G is for Geccos" >G
|
||||
|
||||
rmdir H
|
||||
echo "H is for Human" >H
|
||||
|
||||
|
||||
find . >../state.layer-2
|
||||
tree | grep -v directories | tee ../tree.layer-2
|
||||
|
||||
$baseDir/verifyImageFiles.sh 2 $(pwd)
|
||||
|
||||
88
slides/containers/exploring-images/verifyImageFiles.sh
Executable file
88
slides/containers/exploring-images/verifyImageFiles.sh
Executable file
@@ -0,0 +1,88 @@
|
||||
|
||||
fileContentsCompare() {
|
||||
layer=$1
|
||||
text=$2
|
||||
file=$(pwd)/$3
|
||||
|
||||
if [ -f "$file" ]; then
|
||||
|
||||
fileContents=$(cat $file)
|
||||
|
||||
if [ "$fileContents" != "$text" ]; then
|
||||
echo In Layer $layer Unexpected contents in file: $file
|
||||
echo -- Contents: $fileContents
|
||||
echo -- Expected: $text
|
||||
fi
|
||||
else
|
||||
echo Missing File $file in Layer $layer
|
||||
fi
|
||||
}
|
||||
|
||||
checkLayer() {
|
||||
layer=$1
|
||||
|
||||
find . >/tmp/state
|
||||
|
||||
|
||||
if [[ $(diff /tmp/state $targetDir/../state.layer-$layer) ]]; then
|
||||
echo Directory Structure mismatch in layer: $layer
|
||||
diff /tmp/state $targetDir/../state.layer-$layer
|
||||
fi
|
||||
|
||||
case $layer in
|
||||
0)
|
||||
fileContentsCompare $layer "A is for Aardvark" A
|
||||
fileContentsCompare $layer "B is for Beetle" B
|
||||
fileContentsCompare $layer "A is for Cowboy Allan" C/CA
|
||||
fileContentsCompare $layer "A is for Cowboy Buffalo Alex" C/CB/CBA
|
||||
fileContentsCompare $layer "B is for Cowboy Buffalo Bill" C/CB/CBB
|
||||
fileContentsCompare $layer "Z is for Cowboy Zeke" C/CZ
|
||||
fileContentsCompare $layer "A is for Detective Alisha" D/DA
|
||||
fileContentsCompare $layer "B is for Detective Betty" D/DB
|
||||
fileContentsCompare $layer "E is for Elephant" E
|
||||
;;
|
||||
|
||||
# echo "== LAYER 1 == Change File B, Create File C/CC, Add Dir C/CD, Remove File E, Create Dir F, Add File G, Create Empty Dir H"
|
||||
1)
|
||||
fileContentsCompare $layer "A is for Aardvark" A
|
||||
fileContentsCompare $layer "B is for Butterfly" B ## CHANGED FILE B
|
||||
fileContentsCompare $layer "A is for Cowboy Allan" C/CA
|
||||
fileContentsCompare $layer "A is for Cowboy Buffalo Alex" C/CB/CBA
|
||||
fileContentsCompare $layer "B is for Cowboy Buffalo Bill" C/CB/CBB
|
||||
fileContentsCompare $layer "C is for Cowboy Chuck" C/CC ## ADDED FILE C/CC
|
||||
fileContentsCompare $layer "A is for Cowboy Dandy Austin" C/CD/CDA ## ADDED DIR C/CD, ADDED FILE C/CD/CDA
|
||||
fileContentsCompare $layer "Z is for Cowboy Zeke" C/CZ
|
||||
fileContentsCompare $layer "A is for Detective Alisha" D/DA
|
||||
fileContentsCompare $layer "B is for Detective Betty" D/DB
|
||||
## REMOVED FILE E
|
||||
fileContentsCompare $layer "A is for Ferret Albert" F/FA ## ADDED DIR F, ADDED FILE F/A
|
||||
fileContentsCompare $layer "G is for Gorilla" G ## ADDED G
|
||||
## CREATED EMPTY DIR H
|
||||
;;
|
||||
|
||||
# echo "== LAYER 2 == Remove File C/CA, Remove Dir C/CB, Remove Dir C/CB, Remove Dir D Replace with new Dir D, Delete and Recreatee File G, Add File H/HA Create Dir I"
|
||||
2)
|
||||
fileContentsCompare $layer "A is for Aardvark" A
|
||||
fileContentsCompare $layer "B is for Butterfly" B
|
||||
## REMOVED FILE C/CA
|
||||
## REMOVED DIR C/CB
|
||||
fileContentsCompare $layer "C is for Cowboy Chuck" C/CC
|
||||
fileContentsCompare $layer "A is for Cowboy Dandy Austin" C/CD/CDA
|
||||
fileContentsCompare $layer "Z is for Cowboy Zoe" C/CZ ## CHANGED FILE C/CZ
|
||||
## REMOVE DIR D
|
||||
fileContentsCompare $layer "A is for Duplicitous Albatros" D/DA ## RECREATE DIR D, ADD FILE D/DA
|
||||
fileContentsCompare $layer "G is for Geccos" G ## DELETED FILE G, ADDED FILE G (Implicit CHANGED)
|
||||
fileContentsCompare $layer "H is for Human" H ## ADDED FILE H
|
||||
;;
|
||||
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
|
||||
layer=$1
|
||||
targetDir=$2
|
||||
|
||||
echo VERIFYING LAYER $layer
|
||||
|
||||
checkLayer $layer
|
||||
BIN
slides/containers/exploring-images/visualizingLayers.jpg
Normal file
BIN
slides/containers/exploring-images/visualizingLayers.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 219 KiB |
45
slides/k8s/alias-and-references.md
Normal file
45
slides/k8s/alias-and-references.md
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
|
||||
# External References && kubectl Aliases
|
||||
|
||||
Class Slides: https://2022-07-proofpoint.container.training/
|
||||
|
||||
Kubectl Cheat Sheet: https://kubernetes.io/docs/reference/kubectl/cheatsheet/
|
||||
|
||||
Kubernetes API Object and kubectl Explorers
|
||||
|
||||
- https://github.com/GerrySeidman/Kubernetes-Explorer
|
||||
|
||||
Gerry Kubernetes Storage Converence Talks
|
||||
|
||||
- Vault '20: https://www.usenix.org/conference/vault20/presentation/seidman
|
||||
- Data and Dev '21: https://www.youtube.com/watch?v=k_8rWPwJ_38
|
||||
|
||||
Gerry Seidman’s Info
|
||||
|
||||
- gerry.seidman@ardanlabs.com
|
||||
- https://www.linkedin.com/in/gerryseidman/
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Kubectl Aliases
|
||||
|
||||
```bash
|
||||
alias k='kubectl'
|
||||
alias kg='kubectl get'
|
||||
alias kl='kubctl logs'
|
||||
alias ka='kubectl apply -f'
|
||||
alias kd='kubectl delete'
|
||||
alias kdf='kubectl delete -f'
|
||||
alias kb='kubectl describe'
|
||||
alias kex='kubectl explain'
|
||||
alias ke='kubectl edit'
|
||||
alias kx='kubectl exec -it $1 -- /bin/sh'
|
||||
```
|
||||
Note the below is only because of a quirk in how the lab VMs were installed:
|
||||
```bash
|
||||
echo 'kubectl exec -it $1 -- /bin/sh' >kx
|
||||
chmod +x kx
|
||||
sudo mv kx /usr/local/bin/kx
|
||||
```
|
||||
@@ -39,42 +39,36 @@ content:
|
||||
- containers/Dockerfile_Tips.md
|
||||
- containers/Multi_Stage_Builds.md
|
||||
- containers/Exercise_Dockerfile_Advanced.md
|
||||
- # DAY 2
|
||||
- # DAY Actually Day 3
|
||||
- |
|
||||
# Kubernetes
|
||||
- shared/connecting.md
|
||||
#- shared/webssh.md
|
||||
#- k8s/versions-k8s.md
|
||||
- shared/sampleapp.md
|
||||
#- shared/composescale.md
|
||||
#- shared/hastyconclusions.md
|
||||
- shared/composedown.md
|
||||
- k8s/concepts-k8s.md
|
||||
- k8s/kubectlget.md
|
||||
- k8s/kubectl-run.md
|
||||
- k8s/kubenet.md
|
||||
- k8s/kubectlexpose.md
|
||||
- k8s/shippingimages.md
|
||||
#- k8s/buildshiprun-selfhosted.md
|
||||
- k8s/buildshiprun-dockerhub.md
|
||||
- exercises/k8sfundamentals-details.md
|
||||
- # DAY 3
|
||||
- k8s/ourapponkube.md
|
||||
- k8s/labels-annotations.md
|
||||
- k8s/kubectl-logs.md
|
||||
- k8s/logs-cli.md
|
||||
- k8s/namespaces.md
|
||||
- k8s/yamldeploy.md
|
||||
- shared/declarative.md
|
||||
- k8s/declarative.md
|
||||
#- shared/hastyconclusions.md
|
||||
- k8s/concepts-k8s.md
|
||||
- k8s/deploymentslideshow.md
|
||||
- k8s/shippingimages.md
|
||||
- k8s/kubectlget.md
|
||||
- k8s/kubectl-run.md
|
||||
#- k8s/buildshiprun-selfhosted.md
|
||||
- k8s/yamldeploy.md
|
||||
- k8s/alias-and-references.md
|
||||
- # DAY Actually Day 4
|
||||
- k8s/kubectl-logs.md
|
||||
- k8s/logs-cli.md
|
||||
- k8s/labels-annotations.md
|
||||
- k8s/namespaces.md
|
||||
- k8s/authoring-yaml.md
|
||||
- k8s/scalingdockercoins.md
|
||||
- shared/hastyconclusions.md
|
||||
- k8s/daemonset.md
|
||||
- k8s/rollout.md
|
||||
- k8s/healthchecks.md
|
||||
- # DAY 4
|
||||
- # DAY Actually Day 5
|
||||
- k8s/kubenet.md
|
||||
- k8s/kubectlexpose.md
|
||||
- k8s/volumes.md
|
||||
- k8s/configuration.md
|
||||
- k8s/secrets.md
|
||||
@@ -83,6 +77,16 @@ content:
|
||||
- k8s/helm-create-basic-chart.md
|
||||
- k8s/helm-create-better-chart.md
|
||||
- shared/thankyou.md
|
||||
- # DockerCoins
|
||||
- |
|
||||
# (Docker Coins Example)
|
||||
- shared/sampleapp.md
|
||||
- k8s/buildshiprun-dockerhub.md
|
||||
- exercises/k8sfundamentals-details.md
|
||||
- k8s/ourapponkube.md
|
||||
- k8s/scalingdockercoins.md
|
||||
- shared/hastyconclusions.md
|
||||
- shared/composedown.md
|
||||
- # EXTRA
|
||||
- |
|
||||
# (Extra Docker content)
|
||||
|
||||
Reference in New Issue
Block a user