qa club kiev #20. making life easier with docker

Post on 22-Jan-2018

310 Views

Category:

Education

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Making life easier with

Docker

What is

Docker?

Docker is the world’s leading software containerization

platform.

Docker vs Virtual machines

How Docker can help testing

- Exploration of existing Dockerfiles.

- Using dockerized tools.

- Creation of testing infrastructure based on Docker.

...you will also become more acquainted with Linux shell and shell/bash scripting.

Explorating existing Dockerfiles

You can find some useful information how to setup and configure some tools even by exploration of

existing Dockerfiles that can be found on Docker Hub, Github/Bitbucket inside Docker image repositories.

Using existing

dockerized tools

Advantages

● Easy installation and configuration.

● Ability to use a few different tool versions on one machine.

● Easy updating or switching between versions.

● Ability to easily switch tools between ports.

● Ability to use tools and services which aren’t supported by your OS.

Disadvantages

● Some functionality can work not as expected (e.g., there are some troubles in

using Docker inside dockerized Jenkins CI).

● Permissions for files created by Docker. By default, all the files and directories

created inside a Docker container and shared to host machine are owned by

Docker.

● Not all versions can be available for tools that you need.

● Some performance losses are possible on macOS and Windows systems

because of using Docker inside a virtual machine.

Where to search for existing tool images?

You can find existing Docker images using Docker registry:

● Docker Hub - the main Docker registry. https://hub.docker.com/

● Docker Store - place for trusted and Enterprise Ready Containers, Plugins,

and Docker Editions. https://store.docker.com/

Accessing dockerized tools by ports.

- Internal Docker container ports can be exposed to any free host port.

- Internal tool’s ports inside containers are to be exposed as a host machine

ports using docker run “-p” / ”-P” command options.

- Tools or services inside containers can be used through exposed ports by

calling needed port on host machine.

Creating your

own dockerized

tools and

services

Advantages

- Full control on software versions.

- Lightweight images.

- Configuration flexibility.

Disadvantages

- Can be time consuming, especially on the beginning.

- Commonly useless if you don’t need additional customization.

Ways of creating your own image

● Local image building and using on the same machine.

● Local image building and pushing it to Docker registry.

● Remote image building using Docker registry.

...anyway you need to start from writing a Dockerfile.

Creation of

testing

infrastructure

based on

Docker

Preconditions

- You need to have some CI system.

- There is a way to up project instances without human interactions on CI

system.

- It's preferable to have the whole project on docker.

- Understanding of docker-compose extending logic will be very helpful.

Possible docker-compose files structure.

● docker-compose.yml - basic configurations and services that are needed

for all environments.

● docker-compose.override.yml - additional configurations and services

that are commonly used for local environments.

● docker-compose.{whatever}.yml - additional configurations and

services that are needed for other environments.

Example of test environment starting command

Accessing services from another containers

http(s)://{name_of_service_used_in_docker-compose}:{port_inside_container}

Useful links:

● Docker documentation - https://docs.docker.com/manuals/

● Docker-compose documentation - https://docs.docker.com/compose/

● Docker Cookbook - http://shop.oreilly.com/product/0636920036791.do

● Docker Hub - https://hub.docker.com/

● Example of an image for Behat- https://hub.docker.com/r/bergil/docker-behat/

top related