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

[Discussion][WIP] Add more capabilities to the project. #2

Open
lowlevl opened this issue May 10, 2019 · 5 comments
Open

[Discussion][WIP] Add more capabilities to the project. #2

lowlevl opened this issue May 10, 2019 · 5 comments

Comments

@lowlevl
Copy link

lowlevl commented May 10, 2019

Hello @donflopez,

I think you did a great start job for the project and that I could contribute to it,
I found the using syntax pretty elegant and the code very simple,
tho I would like some base features for now, for which I can provide some work.

I think we should discuss about the coding standards, goals and needs of this project, and include them to the README.md.

First of all, I think we should differentiate images and image types:

  • images being the global images functions, like list, pull, create
  • image being the image itself, with delete, inspect

Same for containers/container, networks/network, volumes/volume...

To be compliant with the Docker API and provide a lot of things, we would need:

  • For docker:

    • connect, giving us a docker object, so we can use the following functions on:
    • version, with a way to match the version with a compliant Vec like:
    docker.version()
        .accept(["18.03.1", "18.03.2", "18.04.*", "<=18.05"])
        .expect("Sorry but your docker is outdated.");
    • info with all relevant information.
    • ping because why not, just to test if the server is still reachable.
  • For images:

    • pull to make the Docker server pull, but also
    • get to select an image from a name/crate&tag.
    let img = Images::get("redis", Some("latest")).unwrap();
    • list to list all images.
  • For image:

    • remove to delete it.
    • info to have access to all stats like size, created date.
  • For containers:

    • get container from name:
    let cont = Containers::get("my_redis_instance").unwrap();
    • list to list all containers, but with a mask if needed like:
    let contlist = Containers::list([RUNNING, PAUSED]));
    • create to create a container image we got for Images::get();
  • For container:

    • start / stop / restart / kill / pause / unpause / remove
      As normal use cases but also:
    • config and,
    • commit which will permit to modify the given container and then after all modifications, commit it to the docker daemon.
    let img: Image = Images::get("redis", None).unwrap();
    let cont: Container = Containers::create(img, ContainerConfig::default());
    
    let config: ContainerConfig = cont.config();
    config.attach(STDIN, true);
    config.attach(STDERR, true);
    config.attach(STDOUT, false);
    cont.commit(config);

Also, because the Docker Object has a connect function, he should have a request function, which all other modules should use, replacing your Client trait.

Note: I will be improving this post over time so we can add more and more features.

@lowlevl
Copy link
Author

lowlevl commented May 11, 2019

@donflopez I'm done !

@lowlevl
Copy link
Author

lowlevl commented May 12, 2019

@donflopez, should I start my own project or contribute to yours ?

@donflopez
Copy link
Owner

Hi @nuRRL! I'm glad you like it! Sorry about the delay, I'm travelling and vacationing for this and next week.

I really like all the points you made they're pretty well aligned with what I have in mind, I needed this in a rush so I didn't spend the time to make it better, like versioning and all. Please, contribute to the project, I'll help as much as I can (end of May will have a lot more time).

Let's start with the image split work, others should replicate that one :)

Let's make this the facto docker lib for Rust! 💪 ⚙️

@lowlevl
Copy link
Author

lowlevl commented May 12, 2019

Hello @donflopez, no problem,

I think we should start by the Docker module, which every module will use to request and then split images and image and so on :)

@lowlevl
Copy link
Author

lowlevl commented May 12, 2019

Tho I don't know if I want to contribute or to start my own project, because this would help me to gain some skills in Rust to start over.

Also I'd prefer to work on a GPLv3 project :) For further uses on other projects !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants