Category : docker-api

enter image description here I just started to work on docker.Please help me out with not able to figure out what the error is. ERROR: for pbft_api_1 a bytes-like object is required, not ‘str’ ERROR: for api a bytes-like object is required, not ‘str’ Traceback (most recent call last): File "/usr/lib/python3/dist-packages/docker/api/client.py", line 261, in _raise_for_status ..

Read more

I tried to use Python to get the docker stats, by using Python’s docker module. the code is: import docker cli = docker.from_env() for container in cli.containers.list(): stream = container.stats() print(next(stream)) I run 6 docker containers, but when I run the code, It needs a few second to get all containers’ stats, so is there ..

Read more

I am using a C# API that talks to DockerEngine (Docker.DotNet) to do some things, but notably in this case, removed a stopped container. Here is my code: foreach (var container in RunningContainers) { if (container.State == "dead" || container.State == "exited") { long exitType = Client.Containers.InspectContainerAsync(container.ID).Result.State.ExitCode; if (exitType != 0) { badExitCodeCount++; } Client.Containers.RemoveContainerAsync(container.ID, ..

Read more

I try to connect to docker engine api using Docker.DotNet client. Docker is installed on Windows 10. Connection using named pipeline "npipe://./pipe/docker_engine" is working, also connection using "tcp://localhost:2375" (With enabled option: Expose daemon on tcp://localhost:2375 without TLS) but I am confused with secure connection option. Documentation is clear: var credentials = new CertificateCredentials (new X509Certificate2 ..

Read more

Docker is running, ContainerExecCreate creates a container, but ContainerExecAttach returns: Cannot connect to the Docker daemon at unix: ///var/run/docker.sock in response. Is the docker daemon running? What could be the problem. import ( "archive/tar" "bytes" "context" "fmt" "io" "io/ioutil" "log" "net" "os" "strconv" "strings" "time" client "docker.io/go-docker" "docker.io/go-docker/api/types" "docker.io/go-docker/api/types/container" "docker.io/go-docker/api/types/network" "docker.io/go-docker/api/types/swarm" "docker.io/go-docker/api/types/volume" "github.com/containerd/containerd/reference" "github.com/play-with-docker/play-with-docker/config" ) ..

Read more

I am trying to implement an api endpoint for docker stats –one-shot but I simply do not understand the difference between –one-shot and –no-stream. The API documentation is located here but doesn’t illuminate much. I know this seems like a simple question but I am a newcomer to the docker api and can’t seem to ..

Read more

I tried to build docker image via docker api with passing buildargs parameter My try: curl -X POST -H "Content-Type:application/tar" —unix-socket /var/run/docker.sock —data-binary "@Dockerfile.tar.gz" ‘http://localhost/build?buildargs={"TIMESTAMP":"time"}’ But bad response: {"message":"error reading build args: invalid character ‘:’ after top-level value"} If I remove the buildargs parameter, it works fine. Source: Docker..

Read more