Category : docker-api

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

I am creating a web project using java. Here I am downloading a file from web and I must need to transfer the downloaded file to the docker container. I am using the docker API PUT /containers/{id}/archive https://docs.docker.com/engine/api/v1.41/#operation/PutContainerArchive But, this gives error like below: For copying a simple text file: { "message": "Error processing tar ..

Read more