Skip to content

gufo.thor.docker

Docker utilities.

Attributes:

Name Type Description
docker

Docker singleton.

ComposeConfig dataclass

Bases: object

Effective docker compose config.

Attriburtes

name: Project name

ContainerStatus dataclass

Bases: object

Container status.

Attributes:

Name Type Description
name str

Container name.

Docker

Bases: object

Docker wrapper.

logging_driver cached property

Get docker logging driver.

Returns:

Type Description
str

logging driver name.

destroy()

Destroy installation.

Returns:

Name Type Description
True bool

if command executed successfully.

False bool

otherwise.

die(msg) staticmethod

Show error message and die.

down(*args)

Down services' containers.

Returns:

Name Type Description
True bool

if command executed successfully.

False bool

otherwise.

logs(*args, _follow=False)

Show logs.

pause(labels=None)

Pause all containers having given labels.

Parameters:

Name Type Description Default
labels Optional[Iterable[str]]

Iterable of all required labels.

None

Returns:

Name Type Description
True bool

if command executed successfully.

False bool

otherwise.

pull()

Pull containers.

Returns:

Name Type Description
True bool

if command executed successfully.

False bool

otherwise.

restart(*args)

Perform services restart.

Returns:

Name Type Description
True bool

if command executed successfully.

False bool

otherwise.

shell()

Run shell in container.

Returns:

Name Type Description
True bool

if command executed successfully.

False bool

otherwise.

stats()

Show container stats.

Returns:

Name Type Description
True bool

if command executed successfully.

False bool

otherwise.

stop()

Perform docker compose stop.

Returns:

Name Type Description
True bool

if command executed successfully.

False bool

otherwise.

unpause(labels=None)

Resume all containers having given labels.

Parameters:

Name Type Description Default
labels Optional[Iterable[str]]

Iterable of all required labels.

None

Returns:

Name Type Description
True bool

if command executed successfully.

False bool

otherwise.

up()

Perform docker compose up -d.

Returns:

Name Type Description
True bool

if command executed successfully.

False bool

otherwise.

DockerConfig dataclass

Bases: object

Docker daemon configuration.

Attributes:

Name Type Description
logging_driver str

Current logging driver.

server_version str

Current docker server version.