blob: a95bb12fd4581f69bb2fc1754f9bc9fc88c3899f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
use shiplift::{Docker, VolumeCreateOptions};
use std::{collections::HashMap, env};
#[tokio::main]
async fn main() {
let docker = Docker::new();
let volume_name = env::args()
.nth(1)
.expect("You need to specify an volume name");
let mut labels = HashMap::new();
labels.insert("com.github.softprops", "shiplift");
match docker
.volumes()
.create(
&VolumeCreateOptions::builder()
.name(volume_name.as_ref())
.labels(&labels)
.build(),
)
.await
{
Ok(info) => println!("{:?}", info),
Err(e) => eprintln!("Error: {}", e),
}
}
|