Code Monkey home page Code Monkey logo

docker-api-rs's Introduction

docker-api

GitHub Actions MIT licensed Released API docs

a rust interface to Docker containers

Install

Add the following to your Cargo.toml file

[dependencies]
docker-api = "0.14"

Supported API

Default endpoints include:

  • Containers
  • Images
  • Networks
  • Volumes
  • Exec
  • System

To enable swarm endpoints add a swarm feature to Cargo.toml like so:

docker-api = { version = "0.14", features = ["swarm"] }

Swarm endpoints include:

  • Swarm
  • Nodes
  • Services
  • Tasks
  • Secrets
  • Configs
  • Plugins

Latest stable version of this crate supports API version: v1.42 Master branch supports: v1.43

Features

SSL Connection

To enable HTTPS connection to docker add a tls flag to Cargo.toml.

Chrono

To enable chrono DateTime timestamps add a chrono feature flag to Cargo.toml.

Default features

By default only chrono feature is enabled. To disable it use:

docker-api = { version = "0.14", default-features = false }

Usage

Examples for most API endpoints can be found in the examples directory.

Notice

This crate is a fork of shiplift.

License

MIT

docker-api-rs's People

Contributors

ashwinvin avatar casibbald avatar d-brox avatar malopolese avatar primoze avatar rakai93 avatar rukai avatar slonegg avatar sonicrules1234 avatar vv9k avatar zookatron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

docker-api-rs's Issues

Active?

Looks like there hasn't been any activity here in 9mos or so..

@vv9k is the plan for this to be actively maintained moving forward or is it better to stick to a fork?

Support for npipe protocol for connecting on Windows

Is it possible to add support for connecting to Docker using npipe:////./pipe/docker_engine like in this guide? Currently I'm using tcp://localhost:2375 protocol. However, to use that protocol it is necessary to enable "Expose daemon on tcp://localhost:2375 without TLS" feature in Docker settings which is not convenient if you need to configure many machines. It is also slower and less secure.

Build problem

With "docker-api = { version = "*" }" in Cargo.toml of my project, cargo build gives

>cargo build                                                                                        
    Updating crates.io index
   Compiling docker-api v0.5.1
error[E0432]: unresolved import `futures_util::Stream`
  --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/docker-api-0.5.1/src/api/container/mod.rs:12:5
   |
12 |     Stream, TryStreamExt,
   |     ^^^^^^
   |     |
   |     no `Stream` in the root
   |     help: a similar name exists in the module (notice the capitalization): `stream`

error[E0432]: unresolved import `futures_util::Stream`
 --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/docker-api-0.5.1/src/api/system/mod.rs:9:20
  |
9 | use futures_util::{Stream, TryStreamExt};
  |                    ^^^^^^
  |                    |
  |                    no `Stream` in the root
  |                    help: a similar name exists in the module (notice the capitalization): `stream`

error[E0405]: cannot find trait `Stream` in crate `futures_util`
   --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/docker-api-0.5.1/src/builder.rs:539:33
    |
539 |           ) -> impl futures_util::Stream<Item = crate::Result<crate::conn::TtyChunk>> + Unpin + 'docker {
    |                                   ^^^^^^ not found in `futures_util`
    |
   ::: /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/docker-api-0.5.1/src/api/container/mod.rs:26:5
    |
26  | /     impl_api_ep! {container: Container, resp
27  | |         Inspect -> &format!("/containers/{}/json", container.id)
28  | |         Logs -> &format!("/containers/{}/logs", container.id)
29  | |         DeleteWithOpts -> &format!("/containers/{}", container.id), String, delete
30  | |     }
    | |_____- in this macro invocation
    |
    = note: this error originates in the macro `impl_api_ep` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
    |
5   | use futures_util::stream::Stream;
    |
5   | use std::stream::Stream;
    |
5   | use core::stream::Stream;
    |

Some errors have detailed explanations: E0405, E0432.
For more information about an error, try `rustc --explain E0405`.
error: could not compile `docker-api` due to 3 previous errors

Another thing is that docker-api = { version = "0.6.0" } did not work. Apparently, version 0.5.1 is the latest I could get with cargo build.

  • Crate version: 0.6.0
  • OS: Ubuntu 20.10
  • Output of running docker version on the command line:
    Client:
    Version: 20.10.7
    API version: 1.41
    Go version: go1.13.8
    Git commit: 20.10.7-0ubuntu5.1
    Built: Mon Nov 1 00:33:40 2021
    OS/Arch: linux/amd64
    Context: default
    Experimental: true

Server:
Engine:
Version: 20.10.7
API version: 1.41 (minimum version 1.12)
Go version: go1.13.8
Git commit: 20.10.7-0ubuntu5.1
Built: Thu Oct 21 23:58:58 2021
OS/Arch: linux/amd64
Experimental: true
containerd:
Version: 1.5.5-0ubuntu3
GitCommit:
runc:
Version: 1.0.1-0ubuntu2
GitCommit:
docker-init:
Version: 0.19.0
GitCommit:

Image build takes time when build context is big

  • Crate version: tested on c58eed7
  • OS: debian bullseye
  • Output of running docker version on the command line:
Client: Docker Engine - Community
 Version:           20.10.21
 API version:       1.41
 Go version:        go1.18.7
 Git commit:        baeda1f
 Built:             Tue Oct 25 18:02:28 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.21
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.7
  Git commit:       3056208
  Built:            Tue Oct 25 18:00:19 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.9
  GitCommit:        1c90a442489720eec95342e1789ee8a5e1b9536f
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Hello, I tried to build a docker image with the example : cargo run --example image -- build .

This succeeds but it takes a very long time (~50 minutes), even with a simple Dockerfile. After some investigation, it seems that this is the sending of build context to the daemon that slows down the build.
For my test, I had the Dockerfile at the root of this repo, so it had to send ~1.8Gb of build context.
Doing the same test with the Dockerfile in an empty directory, the build is almost immediate.

Do you have any hint to reduce the build time when the build context is big ?

`Multiplexer::close` does not close stdin

The following program does not end because the cat is waiting for stdin forever:

use docker_api::{api::ContainerCreateOpts, Docker};
use futures_util::AsyncWriteExt;
use std::env;

#[tokio::main]
async fn main() {
    let uri: String = env::var("DOCKER_HOST").unwrap_or("unix:///var/run/docker.sock".to_string());
    let docker = Docker::new(uri).unwrap();
    let opts = ContainerCreateOpts::builder("alpine")
        .cmd(["sh", "-c", "cat>a"])
        .attach_stdin(true)
        .build();
    let container = docker.containers().create(&opts).await.unwrap();
    let mut m = container.attach().await.unwrap();
    container.start().await.unwrap();
    let mut text = &b"input"[..];
    m.write_all(&mut text).await.unwrap();
    m.close().await.unwrap();
    container.wait().await.unwrap();
}

Multiplexer::close should send EOF to cat.

  • Crate version: 0.8.0
  • OS: Fedora 34
  • Output of running docker version on the command line: Client:
Docker Engine - Community
 Version:           20.10.13
 API version:       1.41
 Go version:        go1.16.15
 Git commit:        a224086
 Built:             Thu Mar 10 14:08:23 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.13
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.15
  Git commit:       906f57f
  Built:            Thu Mar 10 14:06:09 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.5.10
  GitCommit:        2a1d4dbdb2a1030dc5b01e96fb110a9d9f150ecc
 runc:
  Version:          1.0.3
  GitCommit:        v1.0.3-0-gf46b6ba
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

is there an equivalent of `--file` as used through the Docker cli?

In the docker reference page they outline the ability to pass in a path to a dockerfile using --file. So from the command line we can run something like:

docker build -t <tag-name> -f <path-to-docker-file> <path-to-context>

I can't seem to find this functionality or the equivalent implementation. Also could have totally just missed it.

I would love to utilize this functionality since I have a Dockerfile in a large repository and Images::build() and Images::build_par() are too slow. So would love to have a Dockerfile in its own directory within the large repo and build an image as I can through the command line like:

docker build -t <tag-name> -f <large-repo/dockerfile-repo/Dockerfile> <large-repo>

Does this functionality exist? Or is there an equivalent way of doing this? Once again, I may have missed it in the docs/code, so my apologies if that is the case!
Thank you!

  • Greg

Build fail on Windows

  • Crate version:
    master head

  • OS:
    Windows 11

  • Output of running docker version on the command line:

Client:
 Cloud integration: 1.0.17
 Version:           20.10.7
 API version:       1.41
 Go version:        go1.16.4
 Git commit:        f0df350
 Built:             Wed Jun  2 12:00:56 2021
 OS/Arch:           windows/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.7
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       b0f5bc3
  Built:            Wed Jun  2 11:54:58 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.6
  GitCommit:        d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc:
  Version:          1.0.0-rc95
  GitCommit:        b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Would be nice if state were enum

Thank you so much for making this! It is just what I need.

It would be nice if the container state were an enum not a string.

lifetime problem for log stream

Hi,

I need to abstract logs, but run into some lifetime / borrow issues. Is this just something generally not possible in this specific api due to rust or am i doing something wrong ?

use docker_api::opts::LogsOpts;
use docker_api::*;
use futures::{Stream, TryStreamExt,StreamExt};
use std::result::Result;

struct SomeWrapper {
    runtime: Docker,
}

impl SomeWrapper {
    fn logs(
        &self,
        container_id: &str,
    ) -> impl Stream<Item = Result<String, String>> + Send + Unpin {
        let logs_opts = LogsOpts::builder()
            //.follow(true)
            .stdout(true)
            .stderr(true)
            .timestamps(true)
            .build();

        let container = self.runtime.containers().get(container_id);
        let log_lines = container
            .logs(&logs_opts)
            .map_ok(|message| message.escape_ascii().to_string())
            .map_err(|e| e.to_string());
        log_lines
    }
}

#[tokio::main]
async fn main()  {
    let w = SomeWrapper { runtime: Docker::new("/var/run/docker.socks").unwrap() };
    let mut log_stream= w.logs("<someID>");
    match log_stream.next().await {
        Some(event) => {
            dbg!(event);
        }
        None => {
            println!("Channel Closed")
        }
    }
}

which leads to

error[E0597]: `container` does not live long enough
  --> src\main.rs:23:25
   |
22 |           let container = self.runtime.containers().get(container_id);
   |               --------- binding `container` declared here
23 |           let log_lines = container
   |                           -^^^^^^^^
   |                           |
   |  _________________________borrowed value does not live long enough
   | |
24 | |             .logs(&logs_opts)
   | |_____________________________- argument requires that `container` is borrowed for `'static`
...
28 |       }
   |       - `container` dropped here while still borrowed

For more information about this error, try `rustc --explain E0597`.

I tried lifetime annotations, Box , Rc but honestly i am totally lost and don't see how to solve this. With 'static its still a error[E0515]: cannot return value referencing local variable container`

error[E0515]: cannot return value referencing local variable `container`
  --> src\main.rs:27:9
   |
23 |         let log_lines = container
   |                         --------- `container` is borrowed here
...
27 |         log_lines
   |         ^^^^^^^^^ returns a value referencing data owned by the current function

For more information about this error, try `rustc --explain E0515`.
error: could not compile `docker-logs` (bin "docker-logs") due to previous error

For events that apporach is working fine, but i don't get it working for logs .

        self
            .runtime
            .events(&opts)
            .map_ok(|message| message.escape_ascii().to_string())
            .map_err(|e| e.to_string());

Is this a shiplift fork? Comparison with bollard?

I am trying to use some docker library to write tests. There looks 3 choices in the crates.io: shiplift, bollard and docker-api.

I tried shiplift first because it is best starred but after all I noticed it is unmaintained.

Then look into this library now and notice the APIs are much similar to shiplift. Question 1: Is this a fork?

Question 2 is about comparison with the alternative bollard. What is the strong point of this library against bollard?

TTY Option supresses stdout & stderr

  • Crate version: 0.12.2
  • OS: macOS Ventura 13.1
  • Output of running docker version on the command line:
Client:
 Cloud integration: v1.0.29
 Version:           20.10.17
 API version:       1.41
 Go version:        go1.17.11
 Git commit:        100c701
 Built:             Mon Jun  6 23:04:45 2022
 OS/Arch:           darwin/arm64
 Context:           default
 Experimental:      true

Server: Docker Desktop 4.12.0 (85629)
 Engine:
  Version:          20.10.17
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.11
  Git commit:       a89b842
  Built:            Mon Jun  6 23:01:01 2022
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.8
  GitCommit:        9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Creating a container and attaching stdin, stdout & stderr works perfectly fine but after setting .tty(true) in ContainerCreateOpts no output from stdout and stderr is received.

Example

use docker_api::{Docker, opts::ContainerCreateOpts};
use futures_util::StreamExt;


#[tokio::main]
async fn main() {
	let docker = Docker::new("unix:///var/run/docker.sock").unwrap();

	// First run `docker pull chentex/random-logger`
	let container = docker.containers().create(&ContainerCreateOpts::builder()
		.attach_stdout(true)
		.attach_stdin(true)
		.attach_stderr(true)
		.tty(false)
		.image("chentex/random-logger")
		.auto_remove(true)
		.build()
	).await.unwrap();

	println!("Created container: {}", container.id());

	println!("Starting container...");
	container.start().await.unwrap();
	println!("Started container.");

	let mut multiplexer = container.attach().await.unwrap();
	
	while let Some(next) = multiplexer.next().await {
		let chunk = next.unwrap();

		println!("{chunk:?}");
	}
}

Works as expected. Output is printed to console.

After changing .tty(false) to .tty(true) (like the following) no output is printed:

use docker_api::{Docker, opts::ContainerCreateOpts};
use futures_util::StreamExt;


#[tokio::main]
async fn main() {
	let docker = Docker::new("unix:///var/run/docker.sock").unwrap();

	// First run `docker pull chentex/random-logger`
	let container = docker.containers().create(&ContainerCreateOpts::builder()
		.attach_stdout(true)
		.attach_stdin(true)
		.attach_stderr(true)
		.tty(true)
		.image("chentex/random-logger")
		.auto_remove(true)
		.build()
	).await.unwrap();

	println!("Created container: {}", container.id());

	println!("Starting container...");
	container.start().await.unwrap();
	println!("Started container.");

	let mut multiplexer = container.attach().await.unwrap();
	
	while let Some(next) = multiplexer.next().await {
		let chunk = next.unwrap();

		println!("{chunk:?}");
	}

}

Issue: No output is printed to stdout.

In both scenarios I manually checked the logs of the container and they were filled with log messages.


Edit: Improved code formatting.

`cargo run --example image -- list` fails

  • Crate version: latest git
  • OS: arch linux
  • Output of running docker version on the command line:
Client:
 Version:           20.10.18
 API version:       1.41
 Go version:        go1.19.1
 Git commit:        b40c2f6b5d
 Built:             Sat Sep 10 11:31:10 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.18
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.19.1
  Git commit:       e42327a6d3
  Built:            Sat Sep 10 11:30:17 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.6.8
  GitCommit:        9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6.m
 runc:
  Version:          1.1.4
  GitCommit:
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

When running the image example in the repo I get the following:

rukai@memes examples$ cargo run --example image -- list
   Compiling docker-api v0.11.0 (/home/rukai2/Projects/Crates/docker-api-rs)
    Finished dev [unoptimized + debuginfo] target(s) in 0.79s
     Running `/home/rukai2/Projects/Crates/docker-api-rs/target/debug/examples/image list`
Error: invalid value: integer `-1`, expected usize at line 1 column 17

Examples like: cargo run --example container -- list succeed for me.

Upgrade to v1.42 API version

  • POST /containers/{id}/stop and POST /containers/{id}/restart now accept a signal query parameter, which allows overriding the container’s default stop- signal.
  • GET /images/json now accepts query parameter shared-size. When set true, images returned will include SharedSize, which provides the size on disk shared with other images present on the system.
  • GET /system/df now accepts query parameter type. When set, computes and returns data only for the specified object type. The parameter can be specified multiple times to select several object types. Supported values are: container, image, volume, build-cache.
  • GET /_ping and HEAD /_ping now return Builder-Version by default. This header contains the default builder to use, and is a recommendation as advertised by the daemon. However, it is up to the client to choose which builder to use.
  • POST /volumes/create now accepts a new ClusterVolumeSpec to create a cluster volume (CNI). This option can only be used if the daemon is a Swarm manager. The Volume response on creation now also can contain a ClusterVolume field with information about the created volume.
  • Added a new PUT /volumes{name} endpoint to update cluster volumes (CNI). Cluster volumes are only supported if the daemon is a Swarm manager.
  • GET /containers/{name}/attach/ws endpoint now accepts stdin, stdout and stderr query parameters to only attach to configured streams.
    NOTE: These parameters were documented before in older API versions, but not actually supported. API versions before v1.42 continue to ignore these parameters and default to attaching to all streams. To preserve the pre-v1.42 behavior, set all three query parameters (?stdin=1,stdout=1,stderr=1).
  • POST /containers/{id}/exec now accepts an optional ConsoleSize parameter. It allows to set the console size of the executed process immediately when it’s created.

The lifetime of `&self` in `Container::exec` shouldn't be tied to `'docker`

I believe that Container::exec shouldn't tie the lifetime of &self to 'docker, but rather Container should have a generic lifetime that would let you tie the 'docker lifetime to self.docker itself.

From looking at the implementation, I think the current way isn't required and probably wasn't the intent based on the name of the lifetime.

(Though, I am getting a bit lost in all the macros that actually generate the types. I may be missing a reason why it has to be this way.)


I'm trying to use Container::exec within a function in my library and I want to return the Multiplexer it gives me. However, the lifetime of the Multiplexer is getting tied to the Container struct.

A simplified example:

pub async fn shell(&self, container_id: &str) -> Result<Multiplexer> {
      trace!(container_id, "attach to container");

      let mut container = self.client.containers().get(container_id);

      let create_opts = ExecCreateOpts::builder()
          .attach_stdout(true)
          .attach_stderr(true)
          .attach_stdin(true)
          .detach_keys("ctrl-d")
          .tty(true)
          .command(["/bin/sh"])
          .build();
      let start_opts = ExecStartOpts::builder().tty(true).build();
      let io = container.exec(&create_opts, &start_opts).await?;

      Ok(io)
}

gives

error[E0515]: cannot return value referencing local variable `container`
   --> conductor/src/containers/mod.rs:819:17
    |
817 |                 let io = container.exec(&create_opts, &start_opts).await?;
    |                          ----------------------------------------- `container` is borrowed here
818 |
819 |                 Ok(io)
    |                 ^^^^^^ returns a value referencing data owned by the current function

Add `—net` option to container creation.

Greetings,
After looking into source code, docs.rs documentation for this crate and code editor autocomplete I couldn’t find a way to connect a container to a network during creation (as with the --network flag).

Have I missed this or is this actually not implemented yet?

Stdin for Execs

Hello, thank you for creating this library, enjoying it a lot.

But there's a problem I couldn't quite figure out how to solve:

Let's say I have a running container which I attached using .attach(), which streams some stdout, then I want to make a separate exec (docker exec -it /bin/sh) to work with this container in a separate tab, but seems like I could't do it because container.exec() returns only output and doesn't have an option to accept input.

I'd like to propose adding the ability to use attach for execs, or provide stdin handle for execs.

I would like to hear your thoughts on this, thank you.

Need help implementing list docker images outside of example

I am trying to implement the list docker images example in my own project, but something is wrong. I am missing something fundamental and would appreciate a review of this code:

  async fn ListDockerImages() -> Result<(), Box<dyn std::error::Error>> {
  let docker = Docker::unix("/var/run/docker.sock");
  use docker_api::opts::ImageListOpts;
  let opts = ImageListOpts::builder().all(true).build();
  match docker.images().list(&opts).await {
    Ok(images) => {
      images.into_iter().for_each(|image| {
        println!(
          "---------------------------------\nCreated: {}\nId: {}\nRepo tags: {}\nLabels:\n{}",
        image.created,
        image.id,
        image.repo_tags.join(","),
        image
        .labels
        .into_iter()
        .map(|(k, v)| format!(" - {}={}", k, v))
        .collect::<Vec<_>>()
        .join("\n"),
        );
      });
    }
    Err(e) => eprintln!("Problem listing docker images: {}", e),
  }

  Ok(())
}

#[tokio::main]
async fn main() {
    ListDockerImages().await;
}

When I run this program, I get Problem listing docker images: invalid value: integer `-1`, expected usize at line 1 column 17, not the actual listing I get when running the cargo run --example image -- list.

What am I doing wrong that the example code is doing correctly? Thanks in advance.

How to write to stdin of exec?

Hey there! Was checking out the example for exec and I see it returns a stream with chunks of stdout, stderr, and stdin.

Two questions:

  • What is the purpose of the stdin chunk? Shouldn't you be writing it, not reading it?
  • How would I write to the stdin of a cmd started with exec?

For example, if I used exec to start a /bin/sh process in my container with tty enabled, how would I write to its stdin?

Thanks for putting this crate together! Hoping to use it for chipsenkbeil/distant#194

Null Cmd field during pkger build

Client: Docker Engine - Community
 Version:           20.10.7
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        f0df350
 Built:             Wed Jun  2 11:56:47 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.7
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       b0f5bc3
  Built:            Wed Jun  2 11:54:58 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.6
  GitCommit:        d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc:
  Version:          1.0.0-rc95
  GitCommit:        b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

I am trying to build a pkger recipe. The following is the output from RUST_LOG=docker_api=trace,pkger=trace pkger build decide.rs. (The logs from before the broken message are in the details tag.)

TRACE log_filter=docker_api=trace,pkger=trace TRACE fmt_filter=FmtFilter { show_date: false, show_fields: false, hide_level: false, show_spans: false, delimiter: ", ", } TRACE opts=Opts { quiet: false, debug: false, trace: false, filter: None, config: None, command: Build( BuildOpts { recipes: [ "decide.rs", ], simple: None, images: None, docker: None, all: false, no_sign: false, }, ), } TRACE config_path=/home/melizalab/.pkger.yml TRACE config=Configuration { recipes_dir: "/home/melizalab/lab_packages/recipes", output_dir: "/home/melizalab/lab_packages/packages", images_dir: Some( "/home/melizalab/lab_packages/images", ), docker: None, gpg_key: None, gpg_name: None, forward_ssh_agent: true, } TRACE images_state=RwLock { value: ImagesState { images: {}, state_file: ".pkger.state", }, } TRACE loading, recipe=decide.rs TRACE using default docker uri TRACE creating new build context, id=pkger-decide-linux-armv7a-1626563777 INFO running job, id=pkger-decide-linux-armv7a-1626563777 TRACE resolved_deps={ "tar", "dpkg", "libczmq-dev", "git", } TRACE recipe=RecipeTarget { name: "decide", image_target: ImageTarget { image: "linux-armv7a", build_target: Deb, os: None, }, } TRACE checking if image should be rebuilt DEBUG building from scratch, image=linux-armv7a TRACE sending request POST unix://2f72756e2f646f636b65722e736f636b:0/v1.41/build?t=linux-armv7a%3Alatest, log.target="docker_api::conn::transport", log.module_path="docker_api::conn::transport", log.file="/home/melizalab/.cargo/git/checkouts/docker-api-rs-9127327c5ec9cacd/8126914/src/conn/transport.rs", log.line=357 TRACE got response 200 OK {"api-version": "1.41", "content-type": "application/json", "docker-experimental": "false", "ostype": "linux", "server": "Docker/20.10.7 (linux)", "date": "Sat, 17 Jul 2021 23:16:17 GMT", "transfer-encoding": "chunked"}, log.target="docker_api::conn::transport", log.module_path="docker_api::conn::transport", log.file="/home/melizalab/.cargo/git/checkouts/docker-api-rs-9127327c5ec9cacd/8126914/src/conn/transport.rs", log.line=237 TRACE got chunk b"{\"stream\":\"Step 1/1 : FROM dockcross/linux-armv7a:latest\"}\r\n", log.target="docker_api::docker", log.module_path="docker_api::docker", log.file="/home/melizalab/.cargo/git/checkouts/docker-api-rs-9127327c5ec9cacd/8126914/src/docker.rs", log.line=308 INFO Step 1/1 : FROM dockcross/linux-armv7a:latest TRACE got chunk b"{\"stream\":\"\\n\"}\r\n", log.target="docker_api::docker", log.module_path="docker_api::docker", log.file="/home/melizalab/.cargo/git/checkouts/docker-api-rs-9127327c5ec9cacd/8126914/src/docker.rs", log.line=308 INFO

TRACE got chunk b"{"stream":" ---\u003e 9ffc72f820e7\n"}\r\n", log.target="docker_api::docker", log.module_path="docker_api::docker", log.file="/home/melizalab/.cargo/git/checkouts/docker-api-rs-9127327c5ec9cacd/8126914/src/docker.rs", log.line=308
INFO ---> 9ffc72f820e7

TRACE got chunk b"{"aux":{"ID":"sha256:9ffc72f820e7826fc4939b458fcbe9945f17ca8032e9afe638a3bc6a0a90ca0e"}}\r\n", log.target="docker_api::docker", log.module_path="docker_api::docker", log.file="/home/melizalab/.cargo/git/checkouts/docker-api-rs-9127327c5ec9cacd/8126914/src/docker.rs", log.line=308
TRACE sending request POST unix://2f72756e2f646f636b65722e736f636b:0/v1.41/containers/create, log.target="docker_api::conn::transport", log.module_path="docker_api::conn::transport", log.file="/home/melizalab/.cargo/git/checkouts/docker-api-rs-9127327c5ec9cacd/8126914/src/conn/transport.rs", log.line=357
TRACE got response 201 Created {"api-version": "1.41", "content-type": "application/json", "docker-experimental": "false", "ostype": "linux", "server": "Docker/20.10.7 (linux)", "date": "Sat, 17 Jul 2021 23:16:17 GMT", "content-length": "88"}, log.target="docker_api::conn::transport", log.module_path="docker_api::conn::transport", log.file="/home/melizalab/.cargo/git/checkouts/docker-api-rs-9127327c5ec9cacd/8126914/src/conn/transport.rs", log.line=237
TRACE {"Id":"fb213ca2762463acbbb658acdb0c4356bfe5bdc8aae80d21ef7e16d86e537ff7","Warnings":[]}
, log.target="docker_api::docker", log.module_path="docker_api::docker", log.file="/home/melizalab/.cargo/git/checkouts/docker-api-rs-9127327c5ec9cacd/8126914/src/docker.rs", log.line=216
INFO created container, id=fb213ca27624
TRACE sending request POST unix://2f72756e2f646f636b65722e736f636b:0/v1.41/containers/fb213ca2762463acbbb658acdb0c4356bfe5bdc8aae80d21ef7e16d86e537ff7/start, log.target="docker_api::conn::transport", log.module_path="docker_api::conn::transport", log.file="/home/melizalab/.cargo/git/checkouts/docker-api-rs-9127327c5ec9cacd/8126914/src/conn/transport.rs", log.line=357
TRACE got response 204 No Content {"api-version": "1.41", "docker-experimental": "false", "ostype": "linux", "server": "Docker/20.10.7 (linux)", "date": "Sat, 17 Jul 2021 23:16:18 GMT"}, log.target="docker_api::conn::transport", log.module_path="docker_api::conn::transport", log.file="/home/melizalab/.cargo/git/checkouts/docker-api-rs-9127327c5ec9cacd/8126914/src/conn/transport.rs", log.line=237
INFO started container, id=fb213ca27624
TRACE stdout=true, stderr=true
INFO collecting output
TRACE sending request GET unix://2f72756e2f646f636b65722e736f636b:0/v1.41/containers/fb213ca2762463acbbb658acdb0c4356bfe5bdc8aae80d21ef7e16d86e537ff7/logs?stderr=true&stdout=true, log.target="docker_api::conn::transport", log.module_path="docker_api::conn::transport", log.file="/home/melizalab/.cargo/git/checkouts/docker-api-rs-9127327c5ec9cacd/8126914/src/conn/transport.rs", log.line=357
TRACE got response 200 OK {"api-version": "1.41", "docker-experimental": "false", "ostype": "linux", "server": "Docker/20.10.7 (linux)", "date": "Sat, 17 Jul 2021 23:16:18 GMT", "transfer-encoding": "chunked"}, log.target="docker_api::conn::transport", log.module_path="docker_api::conn::transport", log.file="/home/melizalab/.cargo/git/checkouts/docker-api-rs-9127327c5ec9cacd/8126914/src/conn/transport.rs", log.line=237
TRACE stderr=
TRACE stdout=PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

DEBUG parsed image info, os=Os {
distribution: Debian,
version: Some(
"11",
),
}
TRACE sending request GET unix://2f72756e2f646f636b65722e736f636b:0/v1.41/images/sha256:9ffc72f820e7826fc4939b458fcbe9945f17ca8032e9afe638a3bc6a0a90ca0e/json, log.target="docker_api::conn::transport", log.module_path="docker_api::conn::transport", log.file="/home/melizalab/.cargo/git/checkouts/docker-api-rs-9127327c5ec9cacd/8126914/src/conn/transport.rs", log.line=357
TRACE got response 200 OK {"api-version": "1.41", "content-type": "application/json", "docker-experimental": "false", "ostype": "linux", "server": "Docker/20.10.7 (linux)", "date": "Sat, 17 Jul 2021 23:16:18 GMT", "transfer-encoding": "chunked"}, log.target="docker_api::conn::transport", log.module_path="docker_api::conn::transport", log.file="/home/melizalab/.cargo/git/checkouts/docker-api-rs-9127327c5ec9cacd/8126914/src/conn/transport.rs", log.line=237

TRACE {"Id":"sha256:9ffc72f820e7826fc4939b458fcbe9945f17ca8032e9afe638a3bc6a0a90ca0e","RepoTags":["dockcross/linux-armv7a:latest","linux-armv7a:latest"],"RepoDigests":["dockcross/linux-armv7a@sha256:7038d80ef3f6b2354f7accd55afbf3996886d2b11780197117f24c317e04bb6b"],"Parent":"","Comment":"","Created":"2021-07-08T23:45:18.844953662Z","Container":"8c69d3f715db948f79f821de64c22cf644fec8d4f27111f6f3cba3828929af86","ContainerConfig":{"Hostname":"8c69d3f715db","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/bin","CT_VERSION=62e9db247be34f8a4fa3bc116e60a1b15db62a97","XCC_PREFIX=/usr/xcc","CROSS_TRIPLE=arm-cortexa8_neon-linux-gnueabihf","CROSS_ROOT=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf","AS=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/bin/arm-cortexa8_neon-linux-gnueabihf-as","AR=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/bin/arm-cortexa8_neon-linux-gnueabihf-ar","CC=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/bin/arm-cortexa8_neon-linux-gnueabihf-gcc","CPP=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/bin/arm-cortexa8_neon-linux-gnueabihf-cpp","CXX=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/bin/arm-cortexa8_neon-linux-gnueabihf-g++","LD=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/bin/arm-cortexa8_neon-linux-gnueabihf-ld","FC=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/bin/arm-cortexa8_neon-linux-gnueabihf-gfortran","QEMU_LD_PREFIX=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/arm-cortexa8_neon-linux-gnueabihf/sysroot","QEMU_SET_ENV=LD_LIBRARY_PATH=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/lib:/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/arm-cortexa8_neon-linux-gnueabihf/sysroot","DEFAULT_DOCKCROSS_IMAGE=dockcross/linux-armv7a:latest","CMAKE_TOOLCHAIN_FILE=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/Toolchain.cmake","PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/","CROSS_COMPILE=arm-cortexa8_neon-linux-gnueabihf-","ARCH=arm"],"Cmd":["/bin/sh","-c","#(nop) ","ENV DEFAULT_DOCKCROSS_IMAGE=dockcross/linux-armv7a:latest"],"Image":"sha256:39b4cbf40fccc5cd00c853bac846a03f817ba622f321bda574874c586e03d622","Volumes":null,"WorkingDir":"/work","Entrypoint":["/dockcross/entrypoint.sh"],"OnBuild":null,"Labels":{"org.label-schema.build-date":"2021-07-08T23:45:15Z","org.label-schema.name":"dockcross/linux-armv7a","org.label-schema.schema-version":"1.0","org.label-schema.vcs-ref":"94745ff","org.label-schema.vcs-url":"https://github.com/dockcross/dockcross","org.label-schema.version":"latest"}},"DockerVersion":"20.10.6+azure","Author":"Matt McCormick \"[email protected]\"","Config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/bin","CT_VERSION=62e9db247be34f8a4fa3bc116e60a1b15db62a97","XCC_PREFIX=/usr/xcc","CROSS_TRIPLE=arm-cortexa8_neon-linux-gnueabihf","CROSS_ROOT=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf","AS=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/bin/arm-cortexa8_neon-linux-gnueabihf-as","AR=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/bin/arm-cortexa8_neon-linux-gnueabihf-ar","CC=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/bin/arm-cortexa8_neon-linux-gnueabihf-gcc","CPP=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/bin/arm-cortexa8_neon-linux-gnueabihf-cpp","CXX=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/bin/arm-cortexa8_neon-linux-gnueabihf-g++","LD=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/bin/arm-cortexa8_neon-linux-gnueabihf-ld","FC=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/bin/arm-cortexa8_neon-linux-gnueabihf-gfortran","QEMU_LD_PREFIX=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/arm-cortexa8_neon-linux-gnueabihf/sysroot","QEMU_SET_ENV=LD_LIBRARY_PATH=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/lib:/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/arm-cortexa8_neon-linux-gnueabihf/sysroot","DEFAULT_DOCKCROSS_IMAGE=dockcross/linux-armv7a:latest","CMAKE_TOOLCHAIN_FILE=/usr/xcc/arm-cortexa8_neon-linux-gnueabihf/Toolchain.cmake","PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/","CROSS_COMPILE=arm-cortexa8_neon-linux-gnueabihf-","ARCH=arm"],"Cmd":null,"Image":"sha256:39b4cbf40fccc5cd00c853bac846a03f817ba622f321bda574874c586e03d622","Volumes":null,"WorkingDir":"/work","Entrypoint":["/dockcross/entrypoint.sh"],"OnBuild":null,"Labels":{"org.label-schema.build-date":"2021-07-08T23:45:15Z","org.label-schema.name":"dockcross/linux-armv7a","org.label-schema.schema-version":"1.0","org.label-schema.vcs-ref":"94745ff","org.label-schema.vcs-url":"https://github.com/dockcross/dockcross","org.label-schema.version":"latest"}},"Architecture":"amd64","Os":"linux","Size":1752123680,"VirtualSize":1752123680,"GraphDriver":{"Data":{"LowerDir":"/var/lib/docker/overlay2/dfb6701fb424aa8e13a44884d06f18ad5e8da502e52d48e9a46e665e0a0e813e/diff:/var/lib/docker/overlay2/d4d7625a0fb57fc5eafd077582c0d318170caed8df4721bfa8a9a0e9c54d78d3/diff:/var/lib/docker/overlay2/ac18d3c8eaa30065955d5f52f40f477b199cd94cbcb78ee63e3c5c142e726418/diff:/var/lib/docker/overlay2/9acb7518e171538aed4fecb7b98caf4a5737db7bbda16fa1ef7a50b73e1cf3d0/diff:/var/lib/docker/overlay2/4a0acf2d89dc4ca09a2f645e8c39c0b78f5d0c73e4ff56937252faf47a1c947d/diff:/var/lib/docker/overlay2/8baa5fc7130848a9f3c3839c92980d568915b666c43c9207b7ec49536c376b68/diff:/var/lib/docker/overlay2/648ba137d7547490a20f6dc5bbbfb14a9b3c77f616d59961ae5e3212703ab293/diff:/var/lib/docker/overlay2/e01a035059b1151a887da26f5beff406e18ec1b20c0408dc1527d5cf16db982b/diff:/var/lib/docker/overlay2/a06ea16709b9a15f7d044a46a98c898a791523308f8b1c7f23a29726e259c400/diff:/var/lib/docker/overlay2/f9d72cd7b9153057b646a6a7248c14efda613d458d9bc471c00f692aa58dcdf4/diff:/var/lib/docker/overlay2/302db90f47968c35f9b794b5a5b60b473775173fd3ea69ff325876250f441598/diff:/var/lib/docker/overlay2/558dcfc88401a4fa96c0796b28bb0b7d619d54cb9d554de9296d9973d252e4c3/diff:/var/lib/docker/overlay2/851a06f233ad02594769ab1dbf20c480583a52761d3bfe0d2f052c90586ce6e9/diff:/var/lib/docker/overlay2/3d0399698f9626b3e47c0f9671fba8076053600452e88445d02f5b309753b75a/diff:/var/lib/docker/overlay2/8c21649ed8861551fad129c889203c83d15be2844a1d14fec3a443f48d331868/diff","MergedDir":"/var/lib/docker/overlay2/ff44dee124e2729d3a8cc061a61fd7a86a8d5139c3ccd0eb8e9c4aaf14ee6896/merged","UpperDir":"/var/lib/docker/overlay2/ff44dee124e2729d3a8cc061a61fd7a86a8d5139c3ccd0eb8e9c4aaf14ee6896/diff","WorkDir":"/var/lib/docker/overlay2/ff44dee124e2729d3a8cc061a61fd7a86a8d5139c3ccd0eb8e9c4aaf14ee6896/work"},"Name":"overlay2"},"RootFS":{"Type":"layers","Layers":["sha256:0fbfe9c110744441e16b6626ce11102c7a4c1ded556f9eb7796efd1756afb36b","sha256:d9c700da423e30f4dc0c4b83d8c108dec73cce4161bb696346801262af96d05e","sha256:b48007fb812e35e0e13d7c29c8d220b0ed72a8d1b7451414168385a7137e8d9c","sha256:641b724aa8e7b5203653feefe4bdf0e8214a79e4b141b04262ee54c0cbaa77c1","sha256:fc500140fca6eefa5e86cb496813a07ab56be5f7d876da316ed64c9498749e6e","sha256:1b92fdc6d96785feb3050f7d622695c190955b30d220a06c7dead3640e967341","sha256:c2e5a56f87987e67316f27d3df473a8edbc29d544c38db5c87dd66491107545e","sha256:238eef010cf4bef08482b8cb30c127d12d4f55109373f3fe4d6436ab86a1f25a","sha256:c5f1c82a20699369897189756f06cf731febc9ba20fedc479c04e44f0534b915","sha256:9b621342ba09af6872758162e7109a7303ef76f98c7cfe58f17aee9650d15e94","sha256:ac83272715286bcb5bc7c8b74f7a6e1d57585224fb9aa342e246ea6d04953e59","sha256:17c94c8cedd7f29a1f961be5f35835f8ad50c0a73085903e703669b46e5dab9a","sha256:f31eba605364a3a423576378b2d4b1f6a9d1ae29820e5f5faab09ba3c717e574","sha256:e37f09d5f0ff0cbace1da2c5f4ca37a86af5ce257eeeee7102b8993e552cbe26","sha256:743f81105424d88afc04c2d55d7ec3b6ca69f1b41339099bf77fb2b490d86e33","sha256:139e5db22604651a516488a0fdcb48cfb134d6a4ca22ea4251074632a262e8ed"]},"Metadata":{"LastTagTime":"2021-07-17T19:16:17.864046973-04:00"}} , log.target="docker_api::docker", log.module_path="docker_api::docker", log.file="/home/melizalab/.cargo/git/checkouts/docker-api-rs-9127327c5ec9cacd/8126914/src/docker.rs", log.line=180 ERROR job failed, id=pkger-decide-linux-armv7a-1626563777, reason=invalid type: null, expected a sequence at line 1 column 4312, duration=0.5375528s TRACE saving images state

It seems like the problem is that the Cmd field has a value of "null", but I don't understand the structure of the code enough to know where that might have come from.

Stream does not close when pulling an image

  • Crate version: 0.9.1
  • OS: MacOS 12.3.1
  • Output of running docker version on the command line:
Client: Docker Engine - Community
 Cloud integration: 1.0.12
 Version:           20.10.5
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        55c4c88
 Built:             Tue Mar  2 20:13:00 2021
 OS/Arch:           darwin/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.5
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       363e9a8
  Built:            Tue Mar  2 20:15:47 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

When pulling an image, per the example in the repository, the image is able to be pulled successfully per the logs, but then the program just hangs, without moving out of the loop, at the end. Is there a way to close the stream or send None when the pull has finished?

    let pull_opts = PullOpts::builder().image(config.image.clone()).build();
    let images = docker.images();
    let mut stream = images.pull(&pull_opts);

    while let Some(pull_result) = stream.next().await {
        match pull_result {
            Ok(output) => {
                println!("{:?}", output);
            },
            Err(e) => eprintln!("{}", e),
        }
    }

PortStatus not present in TaskStatusInlineItem

TaskStatusInlineItem doesn't have PortStatus field, docker swagger doesn't have it too.

    Status:
        type: "object"
        properties:
          Timestamp:
            type: "string"
            format: "dateTime"
          State:
            $ref: "#/definitions/TaskState"
          Message:
            type: "string"
          Err:
            type: "string"
          ContainerStatus:
            type: "object"
            properties:
              ContainerID:
                type: "string"
              PID:
                type: "integer"
              ExitCode:
                type: "integer"

But it present in source code
https://github.com/moby/moby/blob/master/api/types/swarm/task.go#L197
and may be acquired from

curl --silent -XGET --unix-socket /var/run/docker.sock http://localhost/tasks | jq .
  {
    "ID": "jz0dy04hqqiee7req68cn35sr",
    "Version": {
      "Index": 13330
    },
    "CreatedAt": "2023-07-21T17:11:15.900415099Z",
    "UpdatedAt": "2023-07-21T17:11:18.903307684Z",
    "Labels": {},
    "Spec": {
      "ContainerSpec": {
        "Image": "nginx",
        "Isolation": "default"
      },
      "ForceUpdate": 0
    },
    "ServiceID": "19q4qqid37yiht0ex82j89s4u",
    "Slot": 2,
    "NodeID": "d9y196uwpsfu83dub7wj9he9i",
    "Status": {
      "Timestamp": "2023-07-21T17:11:18.820798223Z",
      "State": "running",
      "Message": "started",
      "ContainerStatus": {
        "ContainerID": "6b319540150cd1c551db0ec80962435077910965ea4a96535444a40bf83dafb0",
        "PID": 159542,
        "ExitCode": 0
      },
      "PortStatus": {
        "Ports": [
          {
            "Protocol": "tcp",
            "TargetPort": 80,
            "PublishedPort": 32774,
            "PublishMode": "host"
          },
          {
            "Protocol": "tcp",
            "TargetPort": 80,
            "PublishedPort": 32774,
            "PublishMode": "host"
          }
        ]
      }
    },
    "DesiredState": "running",
    "Volumes": null
  }
  • Crate version: master
  • OS: Arch Linux
  • Output of running docker version on the command line:
 Version:           24.0.2
 API version:       1.43
 Go version:        go1.20.4
 Git commit:        cb74dfcd85
 Built:             Mon May 29 15:50:06 2023
 OS/Arch:           linux/amd64
 Context:           default

Server:
 Engine:
  Version:          24.0.2
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.4
  Git commit:       659604f9ee
  Built:            Mon May 29 15:50:06 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.7.2
  GitCommit:        0cae528dd6cb557f7201036e9f43420650207b58.m
 runc:
  Version:          1.1.8
  GitCommit:        
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Implementation can be derived error

Fix issue with error about implementation not being derived.

    Checking docker-api v0.12.2 (/Users/casibbald/Workspace/microscaler/docker-api-rs)
error: this `impl` can be derived
  --> src/opts/container.rs:51:1
   |
51 | / impl Default for Isolation {
52 | |     fn default() -> Self {
53 | |         Isolation::Default
54 | |     }
55 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
   = note: `-D clippy::derivable-impls` implied by `-D clippy::all`
   = help: remove the manual implementation...
help: ...and instead derive it...
   |
43 | #[derive(Default)]
   |
help: ...and mark the default variant
   |
45 ~     #[default]
46 ~     Default,
   |

error: could not compile `docker-api` due to previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `docker-api` due to previous error

Consider replacing futures_codec with tokio_util

futures_codec is unmaintained and pulls in outdated versions of bytes and pin-project https://deps.rs/crate/futures_codec/0.4.1

I propose that we swap futures_codec with tokio_util (I'm not sure of the exact history here but it seems one was copied into the other at some point because they have the same API)
futures_codec is async runtime agnostic, so if we planned to make docker-api async runtime agnostic as well then using tokio_util would be a misstep. But currently docker-api does use tokio making docker-api tokio specific.

I would be happy to provide a PR to perform this change (here and in container-api), but wanted to check in first to see if this was the right direction.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.