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.

Revisions

  1. Emily Curtin revised this gist Dec 13, 2018. 1 changed file with 53 additions and 0 deletions.
    53 changes: 53 additions & 0 deletions commands.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,53 @@
    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
  2. Emily Curtin created this gist Dec 13, 2018.
    18 changes: 18 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    # 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"]
    23 changes: 23 additions & 0 deletions trivial-deployment.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    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
    11 changes: 11 additions & 0 deletions trivial-ingress.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    apiVersion: v1
    kind: Service
    metadata:
    name: busybox-demo
    spec:
    selector:
    app: busybox-demo
    ports:
    - protocol: TCP
    port: 80
    targetPort: 1234
    23 changes: 23 additions & 0 deletions trivial-service.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    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