Error response from daemon: Container Cli is not running - hyperledger-chaincode

I'm running chaincode sample from https://hyperledger-fabric.readthedocs.io/en/release-1.4/chaincode4ade.html; When I try to bash to container 'cli', I receive error message...
$winpty docker exec -it cli bash
Error response from daemon: Container
cli is not running

Stopped the network, cleaned all containers, and restarted, worked fine for me :)
$docker stop $(docker ps -a -q)
$docker ps -qa|xargs docker rm
$cd...fabric-samples/first-network
$docker-compose -f docker-compose-cli.yaml up

Related

Mongodb docker container exit instantly after starting

Hello im trying to create a docker container for Mongodb
Install worked well and everything looked fine at docker ps --all
But when i started the Docker and then did docker ps --all again it shows up like Exited (14) 3 seconds ago... So for me it looks like that it instantly after starting the docker exited it, and cause of that i cant run any commands like docker exec -it (ID) bash because i get a deamon Error that the container is not running.
What can i do about that? Google solutions didnt helped until now...
Infos
- Ubuntu Version: 20.04 Focal
- Image: mongo:4.4-focal and mongo
- Docker Version: 20.10.7
Commands Used
Installed with: docker run mongo:4.4-focal
Command im running: docker start (ID)
Docker answers with printing ID (like it should when the Container is online)
Command im running: docker exec -it (ID) bash
Error: Error response from daemon: Container (A longer ID) is not running

How to run pg_rewind in postgresql docker container

Got the same question. Running PostgreSQL replication clusters in docker container with the official postgresql docker image, now is trying to work out an approach to do failover.
When running pg_rewind against the previous primary container without stopping PostgreSQL service, the failure occurs:
pg_rewind: fatal: target server must be shut down cleanly
But if I run:
docker exec <container-name> pg_ctl stop -D <datadir>
The container is restarted because of the restart policy unless-stopped.
Found the answer by myself.
Just stop the existing container and run command in a new container using the same image and volume mounts, something like:
docker run -it --rm --name pg_rewind --network=host \
--env="PGDATA=/var/lib/postgresql/data/pgdata" \
--volume=/var/lib/postgresql/data:/var/lib/postgresql/data:rw \
--volume=/var/lib/postgresql:/var/lib/postgresql:rw \
--volume=/var/run/postgresql:/var/run/postgresql:rw \
postgres:12.4 \
pg_rewind --target-pgdata=/var/lib/postgresql/data/pgdata --source-server='host=10.0.0.55 port=5432 dbname=postgres user=replicator password=password'

Cannot shell into the container, rpc error: code = 5 desc ... shim-log.json: no such file or directory

trying to shell into the container by kubectl exec -it xxxxxx
but it returns
rpc error: code = 5 desc = open /var/run/docker/libcontainerd/containerd/faf3fd49262cc738e16368001eba5e1113abcb8a87e7b818cb84af3799906149/30fe901c16e0465aa15b596bf3e4f244fb12a7e4133b6e4da5aa35167a8dfb30/shim-log.json: no such file or directory
trying to reboot the node but not help
Thanks #Prafull Ladha
Eventually I restarted the docker (systemctl restart docker) of that Node which my pods could not be shelled, and it resumes to normal
The problem is with containerd, Once the containerd restart in the background, the docker daemon still try to process event streams against the old socket handles. After that, the error handeling when client can't connect to the containerd leads to the CPU spike on machine.
This is the open issue with docker and currently the workaround is to restart the docker.
sudo systemctl restart docker
It appears like some issue with the docker daemon. it would help if you add the logs from the container to research the root cause.
deploy alpine pod and see if you can get into the container. This is to isolate if the problem is with the platform or the pod that you are running.
kubectl run pingpong --image alpine ping 8.8.8.8
kubectl exec -it <pingpong-pod-name> sh
most likely something wrong with the pod that you are running. share the container logs for further help

docker: Got permission denied while trying to connect to the Docker daemon socket at unix:

I tried this
docker run --rm -it -p 2181:2181 -p 8081:8081 -p 8082:8082 -p 8083:8083 -p 9092:9092 -e ADV_HOST=127.0.0.1 landoop/fast-data-dev
I got error
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.35/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
I have checked if daemon is running
โ— docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since ัƒั‚ะพ 2018-01-23 10:52:50 CET; 2h 14min ago
Docs: https://docs.docker.com
Main PID: 11082 (dockerd)
This is my /etc/default/docker
# Customize location of Docker binary (especially for development testing).
#DOCKERD="/usr/local/bin/dockerd"
# Use DOCKER_OPTS to modify the daemon startup options.
#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
# If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy="http://127.0.0.1:3128/"
# This is also a handy place to tweak where Docker's temporary files go.
#export DOCKER_TMPDIR="/mnt/bigdrive/docker-tmp"
How to edit docker_opts to solve the problem I have?
Try adding your user to the docker group:
Run usermod -aG docker "${USER}", then
either log out and log back in, or run newgrp docker.
After this you have to restart your docker daemon: sudo service docker restart.
If you are running on an Azure virtual machine or similar, try running the Docker command with sudo, e.g.:
sudo tensorflow/tools/ci_build/ci_build.sh CPU bazel test //tensorflow/...

Got permission denied while trying to connect to the Docker daemon socket while executing docker stop

I have 3 containers running on my docker, and I need to stop all of them using the following:
sudo docker stop $(docker ps -q)
When a run the command I got this message:
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.32/containers/json: dial unix /var/run/docker.sock: connect: permission denied
See 'docker stop --help'.
Usage: docker stop [OPTIONS] CONTAINER [CONTAINER...]
Stop one or more running containers
I made some search, and the cases that message show does not apply to my environment. I'm using Ubuntu 16.04 LTS with Docker version 17.09.0-ce, build afdb6d4
What does this message mean?
sudo usermod -a -G docker $USER
Reboot then run:
docker container run hello-world
it worked for me on ubuntu 18.2
If you are getting "permission denied" that probably means you haven't added yourself in users group which can operate upon docker. To fix that, go to your terminal and type:
sudo usermod -aG docker <name-of-user-to-grant-permission>
The 'docker' parameter is group created upon installing docker, and you can check that by typing:
getent group | grep docker
And the second parameter is the user you are adding to the group. The list of users you can check by typing:
getent passwd
For more information about command usermod you can find here.
UPDATED:
I installed docker again and just remembered that when you apply this command you need to restart your machine.
It seems your user cannot use docker command, so you need to run it via sudo in parentheses as well:
sudo docker stop $(sudo docker ps -q)