Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docker.network() documentation and network removal #1259

Merged
merged 2 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions pyinfra/operations/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ def network(
"""
Manage docker networks

+ network_name: Image name
+ driver: Container image and tag ex: nginx:alpine
+ network: Network name
+ driver: Network driver ex: bridge or overlay
+ gateway: IPv4 or IPv6 Gateway for the master subnet
+ ip_range: Allocate container ip from a sub-range
+ ipam_driver: IP Address Management Driver
Expand All @@ -251,8 +251,7 @@ def network(

# Create Docker network
docker.network(
name="Create nginx network",
network_name="nginx",
network="nginx",
attachable=True,
present=True,
)
Expand Down Expand Up @@ -289,7 +288,7 @@ def network(

yield handle_docker(
resource="network",
command="create",
command="remove",
network=network,
)

Expand Down
14 changes: 14 additions & 0 deletions tests/operations/docker.network/remove_network.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"kwargs": {
"network": "nginx",
"present": false
},
"facts": {
"docker.DockerNetwork": {
"object_id=nginx": []
}
},
"commands": [
"docker network rm nginx"
]
}
Loading