Implementation of BashOOP for Docker.
Go to file
2022-01-07 15:40:28 +01:00
libraries Updating copyrights, start method for container, updating BashOOP 2022-01-07 15:30:05 +01:00
.gitmodules Initial commit. 2021-12-29 14:38:28 +01:00
Container.shc Updating copyrights, start method for container, updating BashOOP 2022-01-07 15:30:05 +01:00
Docker.shn Updating copyrights, start method for container, updating BashOOP 2022-01-07 15:30:05 +01:00
Image.shc Adding more documentation. 2022-01-02 00:26:00 +01:00
LICENSE.md Initial commit. 2021-12-29 14:38:28 +01:00
README.md Fixing broken link. 2022-01-07 15:40:28 +01:00
Utils.shc Updating copyrights, start method for container, updating BashOOP 2022-01-07 15:30:05 +01:00

DockerBashOOP


Small implementation of Docker for BashOOP.

Documentation

You can generate the documentation using my BashDocGenerator.

How to use

Import the library:

. $OOP_ROOT/oop.sh

importNamespace "path/to/Docker.shn"

Note: The guides require to know how to use BashOOP Objects.

You can store several docker containers in a single Docker.Container object.
The way it's constructed is using keywords that acts as filter for all current Docker containers (both running and stopped).

For example:
Find all stopped containers based on the image ubuntu:14:04 :

Docker.Container c with_image "ubuntu:14.04" stopped

Note: If you're executing this as a non root user, you may be prompted for your account password in order to access docker data.

A list of all filters can be found in the documentation.

You can see if any object was found using $c.found, and the count of containers found using $c.count.

You can then access their properties like you would any other object:

# Their container name
$c.name

# Their container id
$c.id

# Their base image
$c.image

# Amongst others...
# And assign them:
names="$($c.name)"

Note: When several containers are matched, the value for each container will be put on a new line.