Skip to content

Instantly share code, notes, and snippets.

@ecurtin
Last active December 13, 2018 15:09
Show Gist options
  • Select an option

  • Save ecurtin/d4cd3eafe5fcadb8906752ec81b8c8e2 to your computer and use it in GitHub Desktop.

Select an option

Save ecurtin/d4cd3eafe5fcadb8906752ec81b8c8e2 to your computer and use it in GitHub Desktop.
Docker & Kubernetes Basics (Workshop Materials)
docker build -t registry.ng.bluemix.net/gaq-workshops/trivial-http:latest ./
docker image history registry.ng.bluemix.net/gaq-workshops/trivial-http:latest
docker run -p 1234:1234 --detach registry.ng.bluemix.net/gaq-workshops/trivial-http:latest
curl localhost:1234
curl localhost:1234
---
docker image ls
docker container ls
# grab the id of the running container
docker exec -it <CONTAINER ID> sh
---
# inside container
ls
ps -ef
cat index.html
echo "somethin different" > index.html
cat index.html
# outside container
curl localhost:1234
docker kill <CONTAINER ID>
---
docker run -p 1234:1234 --detach registry.ng.bluemix.net/gaq-workshops/trivial-http:latest
curl localhost:1234
---
# inside container
ls
cat index.html
---
# The following commands require ICM Cloud account setup and cluster access
docker push registry.ng.bluemix.net/gaq-workshops/trivial-http:latest
kubectl apply -f trivial-deployment.yaml
kubectl apply -f trivial-service.yaml
kubectl apply -f trivial-ingress.yaml
kubectl get pods
kubectl describe pod <POD NAME>
kubectl get svc
kubectl get ing
# An utterly trivial webserver for Docker experimentation
# To build and run:
# docker build -t registry.ng.bluemix.net/gaq-workshops/trivial-http:latest ./
# docker run -p 1234:1234 --detach registry.ng.bluemix.net/gaq-workshops/trivial-http:latest
# curl localhost:1234
# To kill off:
# docker container ls
# docker kill <container id>
FROM busybox:latest
EXPOSE 1234
RUN echo "congratz u can haz http" > index.html
CMD ["busybox", "httpd", "-f", "-p", "1234"]
apiVersion: apps/v1
kind: Deployment
metadata:
name: busybox-demo
labels:
app: busybox-demo
spec:
replicas: 1
selector:
matchLabels:
app: busybox-demo
template:
metadata:
labels:
app: busybox-demo
spec:
containers:
- name: trivial-demo
image: registry.ng.bluemix.net/gaq-workshops/trivial-http:latest
ports:
- containerPort: 1234
imagePullSecrets:
- name: emily-cr-secret
apiVersion: v1
kind: Service
metadata:
name: busybox-demo
spec:
selector:
app: busybox-demo
ports:
- protocol: TCP
port: 80
targetPort: 1234
apiVersion: apps/v1
kind: Deployment
metadata:
name: busybox-demo
labels:
app: busybox-demo
spec:
replicas: 1
selector:
matchLabels:
app: busybox-demo
template:
metadata:
labels:
app: busybox-demo
spec:
containers:
- name: trivial-demo
image: registry.ng.bluemix.net/gaq-workshops/trivial-http:latest
ports:
- containerPort: 1234
imagePullSecrets:
- name: emily-cr-secret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment