Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jkniest
Copy link
Contributor

@jkniest jkniest commented Jun 29, 2022

Heyho,

this is my first draft for a class which manages docker networks. With this you can create, remove and check for existance.

I've tried to let the two classes feel quite similar.

Usage:

$network = new DockerNetwork('network-name');

$network->driver('macvlan'); // Allows you to change the driver of the network

$network->create(); // Creates it
$network->remove(); // Removes it
$network->exists(); // Return a bool, whether the network exists

Of course, all of the regular stuff, like changing remote host or setting optional arguments are still in there. Maybe we could refactor it, so that we have a trait which holds the same variables / methods which both uses. But I didn't want to do to much work, in case you don't want this in your package :-)

What I removed though is the ability to create a class instance with a static method, like DockerNetwork::create(……). The problem is, the create method creates the real network in docker and I couldn't come up with a better name for it.

Do you have any ideas?

Thanks in advance! If you don't want this in your package or if I need to something else, please let me know. I've added the README sections and tests.

Related to #18

@freekmurze
Copy link
Member

Thanks for your work on this. The code seems pretty nice, and I do appreciate the added tests.

However, I'm going to pass on this on this. We only want to maintain code that we need ourselves for our projects.
I think you could put the code in a package of your own. If you do, I'll gladly link to it in our readme.

@freekmurze freekmurze closed this Jun 29, 2022
@jkniest jkniest deleted the feature/docker-network branch July 5, 2022 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants