Skip to content

Latest commit

 

History

History
95 lines (64 loc) · 1.86 KB

06-docker.adoc

File metadata and controls

95 lines (64 loc) · 1.86 KB

Docker

Docker: Why ?

the matrix from hell

Docker: What ?

container vs vm

Docker How ?

docker how

Docker: Dockerfile

  • Dockerfile: recipe for building your immutable image

FROM debian:jessie
LABEL Maintainer="Damien DUPORTAL"

RUN apt-get update && apt-get install -y nginx

VOLUME ["/tmp","/app"]

EXPOSE 80

ENTRYPOINT ["/usr/sbin/nginx"]
CMD ["-g","daemon off;"]

Docker: Building Docker Image

  • Using the docker CLI:

docker build -t my_image:1.0.0 ./

Docker: Running a Docker

  • Using the docker CLI:

docker run -P -d my_image:1.0.0

Docker: Demo Application’s Dockerfile

  • Using GitServer, from the repository root

    • Check the Dockerfile content

Docker: Building Demo Application

  • Using Devbox, from the demoapp work directory’s root

    • Checking images with docker images

    • Build an image named demoapp:latest

    • Check again images

Docker: Running Docker Container

  • Check running containers with docker ps

  • Run and test the container with this command:

    docker run -p {demo-docker-port}:8080 -d my_image:1.0.0
    # Then open http://{external-domain}:{demo-docker-port}[]
  • Check again running containers with docker ps

  • Stop it with docker stop <Container ID>

  • Check again running containers with docker ps

Docker: Build and Smoke Test

  • It is a lot of command !

  • What about testing the Docker Image ?

  • The demoapp contains a testing system:

    • It use Bats

    • Files: ./src/test/bats/*.bats

    • Command:

/usr/local/bin/bats ./src/test/bats/docker.bats

That’s all folks !