Skip to main content

DockerLibrary

Library version:   1.0

Library scope:      Docker


Introduction

A library providing keywords for handling docker.

DockerLibrary is Robot Framework's library that provides a set of keywords for handling docker. This library support all Docker CLI(docker) commands and options to work with docker. Furthermore, It provides handling multiple containers and also phenomenon called "docker in docker". The last extra feature is class DotDictionary which makes it easier to work with the output of basic Docker CLI commands.

Table of contents


Docker CLI(docker)

The basic docker (base command) takes this form:

docker | <base command> | [OPTIONS]

Example:

docker  run  --name  test  -dt  ubuntu

Multiple Docker containers

Keywords for handling multiple conatiners at once.

Create multiple containers

Keywords for creating multiple containers with one command.

Returns: List[str], where strings are containers ids which were created

 

create multiple containers | <number of containers> | <name of image>

Example:

create multiple containers  3  ubuntu

Docker command for all containers

Keywords for executing basic Docker CLI commands for multiple containers at once.

Returns:

  • if parameter <parse to dotd> is true: Dict[str, DotDictionary], where keys are containers ids and values are outputs from command execution converted to DotDictionary
  • if parameter <parse to dotd> is false: Dict[str, str], where keys are containers ids and values are strings outputs from command execution
docker command for all | <containers ids> | <parse to dotd> | <base command> | [OPTIONS]

Example:

${containers_id} =  docker  ps  -a  -q
docker command for all  ${containers_id.stdout}  False  rm  -f

Docker in Docker

Keyword for handling docker in docker.

docker in docker

Runs host docker in docker using default Unix socket /var/run/docker.sock and then it creates multiple containers of given image

There are three options for docker in docker host:

  • Ubuntu
  • Alpine
  • Centos

Returns: Dict[str, List[str]], where key is host container id and value is list of containers ids which where created

 

docker in docker | alpine/ubuntu/centos | <custom image> | <number of containers to create>

Example:

docker in docker  alpine  ubuntu  5

Parse commands

Keywords that helps to parse outputs from docker.

Parse docker response

If parameter <parse to dotd> is set True, It will try to parse the output given to DotDictionary and if it fails it returns string. If parameter <parse to dotd> is set False. It will remove all whitespace characters from string given and return that string.

Returns: DotDictionary or List[DotDictionary] or string

DotDictionary is a class for easier working with output of docker commands.

Example of using DotDictionary:

${containers_id} =  docker  ps  -a  -q
${dictionary} =  docker command for all  ${containers_id.stdout}  True  inspect
${values} =  Get Dictionary Values  ${dictionary}
Log  ${values[0].Config.Entrypoint}

Returns: DotDictionary or List[DotDictionary] or string

parse docker response | <response> | <parse to dotd>

Example:

${parsed_to_dotd_output} =  parse docker response  ${result.stdout}  True

get containers ids

Keyword to get containers ids.

Returns: List[str], where strings are container ids

get containers ids

Example:

${containers_ids} =  get containers ids

Metadata

Release files for robotframework-dockerlibrary 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for robotframework-dockerlibrary 1.0.0
File Size Uploaded
robotframework-dockerlibrary-1.0.0.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for robotframework-dockerlibrary 1.0.0
File Interpreter ABI Platform
robotframework_dockerlibrary-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.8 kB

Release files / robotframework-dockerlibrary-1.0.0.tar.gz

Download URL robotframework-dockerlibrary-1.0.0.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ae8482bbb4596559fbfe7663c9a6e4a3659c11e5dd5d2ef5e8f6e2f17128ebc5
BLAKE2b-256 checksum
How to use checksums
6a67220587e033cfd97e85069b7136290b6b774eefbd30efd187aecc79192af6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.10

Release files / robotframework_dockerlibrary-1.0.0-py3-none-any.whl

Download URL robotframework_dockerlibrary-1.0.0-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da7be8d1a85ab1fdd4f58714a58d3f14a466850572aaf6021e86e485e7df8744
BLAKE2b-256 checksum
How to use checksums
7d3bc4038eb31fec2b23d0a620c7435cf9c1f6da843e36fa75f9fbf2d29c35b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.10

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page