-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow custom networks feature from #6.
Allow custom networks feature.
- Loading branch information
Showing
8 changed files
with
113 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.gitignore | ||
pyproject.toml | ||
.idea/ | ||
__pycache__/ | ||
dist/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from enum import IntEnum, unique | ||
|
||
|
||
@unique | ||
class ContainerStatus(IntEnum): | ||
RUNNING = 1 # running | ||
EXITED = 2 # exited |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import time | ||
|
||
from docker.models.containers import Container | ||
from .log_re import log | ||
from .constants import ContainerStatus | ||
|
||
|
||
def check_container(container: Container) -> ContainerStatus: | ||
for _ in range(60): | ||
time.sleep(1) | ||
if container.status != ContainerStatus.RUNNING.name.lower(): | ||
container.reload() | ||
elif container.status == ContainerStatus.RUNNING.name.lower(): | ||
return ContainerStatus.RUNNING | ||
elif container.status == ContainerStatus.EXITED.name.lower(): | ||
log(f'Container name: [{container.name}] is exited') | ||
return ContainerStatus.EXITED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,16 +2,16 @@ | |
|
||
setup( | ||
name='easier-docker', | ||
version='2.1.1', | ||
version='2.2.1', | ||
author='EnSong Wei', | ||
author_email='[email protected]', | ||
description='It can create a container based on the local image. If the image does not exist, the image will be ' | ||
'pulled down. If the container exists, it will be started directly. Then execute any service you want ' | ||
'to execute in the container.', | ||
description='Configure your container image information more easily in python, allowing the container in docker ' | ||
'to execute the configured program you want to execute', | ||
long_description=open('README.md', encoding='utf-8').read(), | ||
long_description_content_type='text/markdown', | ||
url='https://github.com/weiensong/easierdocker', | ||
packages=find_packages(), | ||
license='Apache License 2.0', | ||
install_requires=[ | ||
'docker~=6.1.3', | ||
'setuptools~=68.2.0', | ||
|
@@ -20,7 +20,6 @@ | |
entry_points={ | ||
'console_scripts': [ | ||
'easier-docker=easierdocker.__main__:main', | ||
|
||
], | ||
}, | ||
classifiers=[ | ||
|