faradayio / boondock Goto Github PK
View Code? Open in Web Editor NEWThis project forked from ghmlee/rust-docker
Docker daemon API in Rust
This project forked from ghmlee/rust-docker
Docker daemon API in Rust
Hi, i'm having an issue with the container creation method on the 'feature/containers' branch here Docker keeps returning 'EOF' even though my headers and body are present. I've tested it with Postman and it works properly.
Is there anybody know what to do?
Thank you
Hi, I saw the examples, but there is no way I can understand any of the code, for example, I want to make a container from an image, there is no documentation for this !
For sure I can help if needed !
Edit: I saw there is no support for creating containers :c
Right now, we rely on OpenSSL to handle https
, which means that we need to special-case everything for the Mac. Ideally, this would mean using native-tls, which would in turn involve replacing our ancient hyper
with reqwest
.
Unfortunately...
We need to handle non-TCP Docker sockets, which means we're providing a custom network transport. And reqwest
doesn't support this. At the moment, we use:
unix_socket
for Unix-like systems. This is synchronous only, but it might be possible to switch to hyperlocal.named_pipe
for Windows. This might be replaced with something based on mio-named-pipes.So there's probably a moderate amount of hyper-related code to get us talking securely to Docker again.
We currently have no way to list stopped containers, probably because something has changed in the protocol.
This would be really useful to my project.
I don't know if you have any plan for this, maybe it's out of scope for cage.
I tried to give a quick look at docker's client source code, but wasn't able to find where magic really happens.
So I've been using the lib like so :
user@computer: ~$ cat src/main.rs
extern crate boondock;
use boondock::Docker;
fn main() {
let docker = Docker::connect_with_defaults().unwrap();
}
user@computer: ~$ # No docker on my computer, the program should panic because of the .unwrap().
user@computer: ~$ which docker
user@computer: ~$ # Nor the default socket
user@computer: ~$ ls /var/run/docker.sock
ls: cannot access '/var/run/docker.sock': No such file or directory
user@computer: ~$ cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.20s
Running `target/debug/opendd`
user@computer: ~$ # Unfortunately, no crash .-.
user@computer: ~$
Maybe I don't understand, but it's pretty straight forward to me that this should crash because connect_with_defaults()
returns a Result<Docker>
.
This is a headsup that the current openssl dependency is outdated and doesn't compile on my system anymore. :) I'm currently on openssl 1.1.0.g
The Rust compiler has changed a lot since this code was last worked on, and there are a lot of warnings when this code is compiled now. We need to clean these up.
The ability to create containers is super important for a library like this.
Looking at the Docker source code, it seems like the daemon actually supports multiple protocol versions. Is there some way to tell it what version we're expecting to see?
bookdock instead of boondock
docs.rs cannot build the docs for boondock
. The error seem to be related to openssl.
Are the docs stored someplace else?
Here is the log from docs.rs
--- stdout
TARGET = Some("x86_64-unknown-linux-gnu")
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-gnu = None
CC_x86_64_unknown_linux_gnu = None
HOST_CC = None
CC = None
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
DEBUG = Some("true")
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-m64" "-Wall" "-Wextra" "-o" "/home/cratesfyi/cratesfyi/debug/build/openssl-56b1b41302837114/out/src/c_helpers.o" "-c" "src/c_helpers.c"
cargo:warning=src/c_helpers.c: In function ‘rust_SSL_clone’:
cargo:warning=src/c_helpers.c:4:5: warning: implicit declaration of function ‘CRYPTO_add’ [-Wimplicit-function-declaration]
cargo:warning= CRYPTO_add(&ssl->references, 1, CRYPTO_LOCK_SSL);
cargo:warning= ^~~~~~~~~~
cargo:warning=src/c_helpers.c:4:20: error: dereferencing pointer to incomplete type ‘SSL {aka struct ssl_st}’
cargo:warning= CRYPTO_add(&ssl->references, 1, CRYPTO_LOCK_SSL);
cargo:warning= ^~
cargo:warning=src/c_helpers.c:4:37: error: ‘CRYPTO_LOCK_SSL’ undeclared (first use in this function)
cargo:warning= CRYPTO_add(&ssl->references, 1, CRYPTO_LOCK_SSL);
cargo:warning= ^~~~~~~~~~~~~~~
cargo:warning=src/c_helpers.c:4:37: note: each undeclared identifier is reported only once for each function it appears in
cargo:warning=src/c_helpers.c: In function ‘rust_SSL_CTX_clone’:
cargo:warning=src/c_helpers.c:8:20: error: dereferencing pointer to incomplete type ‘SSL_CTX {aka struct ssl_ctx_st}’
cargo:warning= CRYPTO_add(&ctx->references,1,CRYPTO_LOCK_SSL_CTX);
cargo:warning= ^~
cargo:warning=src/c_helpers.c:8:35: error: ‘CRYPTO_LOCK_SSL_CTX’ undeclared (first use in this function)
cargo:warning= CRYPTO_add(&ctx->references,1,CRYPTO_LOCK_SSL_CTX);
cargo:warning= ^~~~~~~~~~~~~~~~~~~
cargo:warning=src/c_helpers.c: In function ‘rust_X509_clone’:
cargo:warning=src/c_helpers.c:12:21: error: dereferencing pointer to incomplete type ‘X509 {aka struct x509_st}’
cargo:warning= CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509);
cargo:warning= ^~
cargo:warning=src/c_helpers.c:12:36: error: ‘CRYPTO_LOCK_X509’ undeclared (first use in this function)
cargo:warning= CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509);
cargo:warning= ^~~~~~~~~~~~~~~~
exit code: 1
--- stderr
thread 'main' panicked at '
Internal error occurred: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-m64" "-Wall" "-Wextra" "-o" "/home/cratesfyi/cratesfyi/debug/build/openssl-56b1b41302837114/out/src/c_helpers.o" "-c" "src/c_helpers.c" with args "cc" did not execute successfully (status code exit code: 1).
', .cargo/registry/src/github.com-1ecc6299db9ec823/gcc-0.3.54/src/lib.rs:1670:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: failed to run custom build command for `openssl-sys-extras v0.7.14`
process didn't exit successfully: `/home/cratesfyi/cratesfyi/debug/build/openssl-sys-extras-abe14868179e9a5e/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("x86_64-unknown-linux-gnu")
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-gnu = None
CC_x86_64_unknown_linux_gnu = None
HOST_CC = None
CC = None
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
DEBUG = Some("true")
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-m64" "-Wall" "-Wextra" "-o" "/home/cratesfyi/cratesfyi/debug/build/openssl-sys-extras-e60f1107e2e04baa/out/src/openssl_shim.o" "-c" "src/openssl_shim.c"
cargo:warning=src/openssl_shim.c: In function ‘SSL_CTX_set_ecdh_auto_shim’:
cargo:warning=src/openssl_shim.c:121:41: warning: unused parameter ‘ctx’ [-Wunused-parameter]
cargo:warning= int SSL_CTX_set_ecdh_auto_shim(SSL_CTX *ctx, int onoff) {
cargo:warning= ^~~
cargo:warning=src/openssl_shim.c: In function ‘DH_new_from_params’:
cargo:warning=src/openssl_shim.c:132:7: error: dereferencing pointer to incomplete type ‘DH {aka struct dh_st}’
cargo:warning= dh->p = p;
cargo:warning= ^~
cargo:warning=src/openssl_shim.c: In function ‘X509_get_extensions_shim’:
cargo:warning=src/openssl_shim.c:143:13: error: dereferencing pointer to incomplete type ‘X509 {aka struct x509_st}’
cargo:warning= return x->cert_info ? x->cert_info->extensions : NULL;
cargo:warning= ^~
cargo:warning=src/openssl_shim.c:144:1: warning: control reaches end of non-void function [-Wreturn-type]
cargo:warning= }
cargo:warning= ^
exit code: 1
Hi Folks,
In these days, much of the linux kernels running doesnt have the Cgroup Swap support activated and because of this, there is no field called 'swap' for the container stats. When I try to gather some container stats with the following code
for container in &containers {
let _stats = match docker.stats(container) {
Ok(stats) => stats,
Err(e) => { panic!("{}", e); }
};
for stat in _stats{
println!("{:?}", stat);
}
}
It returns to me the message "(Some(Error("missing field swap
", line: 1, column: 4183)), None)))".
Thanks in advance.
docker ps
has some options for filtering the containers it returns:
Usage: docker ps [OPTIONS]
List containers
Options:
-a, --all Show all containers (default shows just running)
-f, --filter value Filter output based on conditions provided (default [])
--format string Pretty-print containers using a Go template
--help Print usage
-n, --last int Show n last created containers (includes all states) (default -1)
-l, --latest Show the latest created container (includes all states)
--no-trunc Don't truncate output
-q, --quiet Only display numeric IDs
-s, --size Display total file sizes
If any of these correspond to flags in the underlying protocol, we may want to implement them. See also #4.
Thank you for your amazing crate !
Can you add a link to: https://docs.rs/boondock/
The following example programs currently fail with JSON parse errors:
cargo run --example stats
cargo run --example images
cargo run --example info
See the forthcoming blog post about how to debug these.
Fork of fork of fork: https://github.com/bpetit/rs-docker-sync#readme
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.