Grails & Docker

GR8Conf US 2017

http://gr8conf.us/talks/542

whoami > Colin Harrington

Virtual Machines
Linux Containers
Docker

Containers

  • LXC
  • Docker
  • Snap Packages

 

Virtual Machine vs Docker

Linux Containers

LXC

OS Container vs App container

Snap Packages

Ubuntu 'snappy'

Docker

https://docs.docker.com/get-started/

An image is a lightweight, stand-alone, executable package that includes everything needed to run a piece of software, including the code, a runtime, libraries, environment variables, and config files.

 

 

A container is a runtime instance of an image—what the image becomes in memory when actually executed. It runs completely isolated from the host environment by default, only accessing host files and ports if configured to do so.

 

 

Containers run apps natively on the host machine’s kernel. They have better performance characteristics than virtual machines that only get virtual access to host resources through a hypervisor. Containers can get native access, each one running in a discrete process, taking no more memory than any other executable.

Docker CE

Community Edition

 

Always free

Evergreen releases

Docker EE

Enterprise Edition


Docker Certified Images

Paid support

 

Stable tested releases

https://blog.docker.com :: 2017/03

$ docker run hello-world

Hello from Docker.
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:
 https://hub.docker.com

For more examples and ideas, visit:
 https://docs.docker.com/userguide/

$ docker run -it ubuntu
root@c84e9c595c43:/# cat /etc/issue
Ubuntu 16.04.2 LTS \n \l

root@c84e9c595c43:/# 

Run a Ubuntu Image

TestContainers

https://testcontainers.org/

 

 

TestContainers is a Java 8 library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.

 

 

https://github.com/testcontainers/testcontainers-java

 

Greach 2017 talk

https://youtu.be/CrsMZM1trxk

testcontainers-spock

https://github.com/testcontainers/testcontainers-spock

Elastic Container Service

https://speakerdeck.com/mpas/running-your-dockerized-application-s-on-aws-ec2-container-service

Dockerfile

Used to build your image

Demo

Docker Compose

docker-compose.yml

version: '3'

services:

  web:
    build: .
    ports:
    - "5000:5000"
    volumes:
    - .:/code
    - logvolume01:/var/log
    links:
    - redis

  redis:
    image: redis

volumes:
  logvolume01: {}

docker-compose.yml

Demo

.env file

Swarm

Networking

...
networks:
  frontend:
    # Use a custom driver
    driver: custom-driver-1
  backend:
    # Use a custom driver which takes special options
    driver: custom-driver-2
    driver_opts:
      foo: "1"
      bar: "2"

Connect with Us

grails.org
groovy-community.grails.org
grailsblog.objectcomputing.com
objectcomputing.com/grails
@grailsframework
@objectcomputing

Thank you for attending!

Please visit our table for giveaways
and to meet the team!

 

ociweb.com/grails
info@ociweb.com

Made with Slides.com