Skip to content
Ensong Wei edited this page Dec 4, 2024 · 4 revisions

Welcome to the eaiser-docker wiki!

Install

It should be a package for your real environment.

pip install easier-docker

Explain

Two params it need now, and network_config and extra_config are kwargs:

Note

  • container_config: Necessary, run and manage containers on the server. Run a container. By default, it will wait for the container to finish and return its logs, similar to docker run.
  • network_config: Unnecessary, create and manage networks on the server. For more information about networks, see the Engine documentation. Create a network. Similar to the docker network create.
  • extra_config: Unnecessary, add extra configurations to the container.Currently used to control whether existing containers will be automatically removed.

Two params config please check:

Important

  1. container_config: Docker SDK for Python with Container
  2. network_config: Docker SDK for Python with Network
  3. extra_config: Include and default value: is_remove, days_ago_remove, remove_now,

is_remove: default value is 0, if it is 1, enable function that will remove the existing container with the same name.
days_ago_remove: default value is 3, it will remove the existing container with the same name if it is older than the specified number of days.
remove_now: default value is 0, if it is 1, days_ago_removewill be ineffective, it will remove the existing container with the same name immediately.

Usage

Use examples in code

example.py

python example.py

code_start

and the docker container logs will be shown in the console.
docker_example.py
docker_logs

Run directly from configuration file

Note

Currently supports type of file: yml, yaml, json

easier-docker -c config.yaml

config.yaml
file