Sanjeet kumar
Sanjeet kumar

Reputation: 3441

ERRO[0001] error waiting for container: context canceled

Getting error while running docker image. It seems to look like the problem is on my pc.

I'm using MacOS 10.13.6. I have followed steps to create a docker image.

Sanjeet:server-api sanjeet$ docker build -t apicontainer .

Sending build context to Docker daemon  24.01MB
Step 1/2 : FROM alpine:3.6
 ---> da579b235e92
Step 2/2 : CMD ["/bin/bash"]
 ---> Running in f43fa95302d4
Removing intermediate container f43fa95302d4
 ---> 64d0b47af4df
Successfully built 64d0b47af4df
Successfully tagged apicontainer:latest

Sanjeet:server-api sanjeet$ docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
apicontainer        latest              64d0b47af4df        3 minutes ago       4.03MB
alpine              3.6                 da579b235e92        2 weeks ago         4.03MB

Sanjeet:server-api sanjeet$ docker run -it apicontainer

docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown.
Sanjeet:server-api sanjeet$ ERRO[0001] error waiting for container: context canceled 

Inside Dockerfile

FROM alpine:3.6

CMD ["/bin/bash"]

Upvotes: 15

Views: 71709

Answers (4)

Phil
Phil

Reputation: 2313

I get this error when the network doesn't exist.

docker: Error response from daemon: network xxx not found.
ERRO[0000] error waiting for container: context canceled

It's quite easy to miss the output line after a long docker command and before the red error message.

Upvotes: 1

frozenOne
frozenOne

Reputation: 554

alpine does not provide glibc. alpine is that small because it uses a stripped down version of libstdc called musl.libc.org.

So we'll check statically linked dependencies using ldd command.

$ docker run -it <image name> /bin/sh
$ cd /go/bin
$ ldd scratch

Check the linked static files, do they exist on that version of alpine? If the do not from, the binaries perspective, it did not find the file-- and will report File not found.

The following step depends on what binaries were missing, you can look it up on the internet on how to install them.

Add RUN apk add --no-cache libc6-compat to your Dockerfile to add libstdc in some Golang alpine image based Dockerfiles.

In you case the solution is to either

  • disable CGO : use CGO_ENABLED=0 while building
  • or add RUN apk add --no-cache libc6-compat to your Dockerfile
  • or do not use golang:alpine

Upvotes: 1

Manish Kumar Singh
Manish Kumar Singh

Reputation: 21

Issues while running/re-initialize Docker

ERRO[0000] error waiting for the container: context canceled

Steps to Stop the Running Docker Container Forcefully

docker ps
//copy the CONTAINER ID of the running process, ex: CONTAINER ID: 37146513b713
docker kill 37146513b713
docker rm 37146513b713

Upvotes: 2

sachav
sachav

Reputation: 1316

alpine does not include bash by default. If you want to include bash, you should add RUN apk add --no-cache bash in your Dockerfile.

Upvotes: 12

Related Questions