Docker – A new way to deploy your Perl apps – Why Use Docker?



Docker – A new way to deploy your Perl apps – Why Use Docker?

0 0


DFWpm-Docker-Demo


On Github PsyDefect / DFWpm-Docker-Demo

Docker

A new way to deploy your Perl apps

Created by John Dexter for DFW.pm

Disclaimer

What is Docker?

  • Application containerization platform
  • Open Source
  • Cross Platform...kinda
  • Complement to VMs
  • Written in Go(?:lang)?

Why Use Docker?

Separation of Concerns

Ease of Deployment

More Efficient

Virtual Machine

Docker

How does it work?

Architecture

  • Docker daemon
  • Docker client

Components

  • Docker Images
  • Docker Registries
  • Docker Container

Technology

  • namespaces
  • cgoups
  • UnionFS
  • libcontainer

The Dockerfile

                            
FROM        perl:5.20
MAINTAINER  John Dexter PsyDefect@users.noreply.github.com

RUN cpanm -n Mojolicious MongoDB MongoDB::OID Log::Log4perl Data::Dumper

EXPOSE 8080

COPY app/ /app

ENTRYPOINT hypnotoad -f /app/app.pl
                            
                        

Docker Hub

Pretty much github for Docker images

Using the Docker Client

                            
docker help
docker COMMAND --help
                            
                        
                            
Usage: docker ps [OPTIONS]

List containers

  -a, --all=false       Show all containers (default shows just running)
  --before=             Show only container created before Id or Name
  -f, --filter=[]       Filter output based on conditions provided
  --help=false          Print usage
  -l, --latest=false    Show the latest created container, with non-running
  -n=-1                 Show n last created containers, with non-running
  --no-trunc=false      Don't truncate output
  -q, --quiet=false     Only display numeric IDs
  -s, --size=false      Display total file sizes
  --since=              Show created since Id or Name, with non-running
                            
                        
                            
Usage: docker images [OPTIONS] [REPOSITORY]

List images

  -a, --all=false      Show all images (default hides intermediate images)
  --digests=false      Show digests
  -f, --filter=[]      Filter output based on conditions provided
  --help=false         Print usage
  --no-trunc=false     Don't truncate output
  -q, --quiet=false    Only show numeric IDs
                            
                        
                            
Usage: docker pull [OPTIONS] NAME[:TAG|@DIGEST]

Pull an image or a repository from the registry

  -a, --all-tags=false    Download all tagged images in the repository
  --help=false            Print usage
                            
                        
                            
Usage: docker build [OPTIONS] PATH | URL | -

Build a new image from the source code at PATH

  -f, --file=           Name of the Dockerfile
                        (Default is 'PATH/Dockerfile')
  --force-rm=false      Always remove intermediate containers
  --no-cache=false      Do not use cache when building the image
  --pull=false          Always attempt to pull newer version of the image
  -q, --quiet=false     Suppress the verbose output
  --rm=true             Remove intermediate containers after build
  -t, --tag=            Repository name (and optionally a tag) for image
  ... and more
                            
                        
                            
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

Run a command in a new container

  -d, --detach=false         Run container in background
  -e, --env=[]               Set environment variables
  -i, --interactive=false    Keep STDIN open even if not attached
  --link=[]                  Add link to another container
  --name=                    Assign a name to the container
  -p, --publish=[]           Publish a container's port(s) to the host
  -t, --tty=false            Allocate a pseudo-TTY
  -v, --volume=[]            Bind mount a volume
  --volumes-from=[]          Mount volumes from the specified container(s)
  ... and many more
                            
                        
                            
Usage: docker start [OPTIONS] CONTAINER [CONTAINER...]

Start one or more stopped containers

  -a, --attach=false         Attach STDOUT/STDERR and forward signals
  --help=false               Print usage
  -i, --interactive=false    Attach container's STDIN
                            
                        
                            
Usage: docker restart [OPTIONS] CONTAINER [CONTAINER...]

Restart a running container

  --help=false       Print usage
  -t, --time=10      Seconds to wait for stop before killing the container

                            
                        
                            
Usage: docker stop [OPTIONS] CONTAINER [CONTAINER...]

Stop a running container by sending SIGTERM and then SIGKILL after a
grace period

  --help=false       Print usage
  -t, --time=10      Seconds to wait for stop before killing it
                            
                        
                            
Usage: docker inspect [OPTIONS] CONTAINER|IMAGE [CONTAINER|IMAGE...]

Return low-level information on a container or image

  -f, --format=      Format the output using the given go template
  --help=false       Print usage

                            
                        
                            
Usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG...]

Run a command in a running container

  -d, --detach=false         Detached mode: run command in the background
  --help=false               Print usage
  -i, --interactive=false    Keep STDIN open even if not attached
  -t, --tty=false            Allocate a pseudo-TTY

                            
                        
                            
Usage: docker rm [OPTIONS] CONTAINER [CONTAINER...]

Remove one or more containers

  -f, --force=false      Force the removal of a running container
  --help=false           Print usage
  -l, --link=false       Remove the specified link
  -v, --volumes=false    Remove the volumes associated with the container

                            
                        
                            
Usage: docker rmi [OPTIONS] IMAGE [IMAGE...]

Remove one or more images

  -f, --force=false    Force removal of the image
  --help=false         Print usage
  --no-prune=false     Do not delete untagged parents

                            
                        

Time to build and app!

Need More?

Documentation

Deployment Tools and Services

This Presentation

https://github.com/PsyDefect/DFWpm-Docker-Demo