On running the command docker container ps -a | grep my_app the docker is showing that its in running status, but the moment I try to see the logs using docker logs -f 858509fc385f where 858509fc385f is the container_id for my_app container. It gives the following error :-
Error grabbing logs: open /var/lib/docker/containers/858509fc385f5ea264f7fd729d9bab32a99742cd0743dc253dcf8a3967ad195c/858509fc385f5ea264f7fd729d9bab32a99742cd0743dc253dcf8a3967ad195c-json.log: no such file or directory
The host machine is CentOS Linux release 7.6.1810.
The docker version details are :-
Any kind of help would be appreciated.
Related
I am trying to get a Docker Container running. I am following this guide: http://opendata.cern.ch/docs/cms-guide-docker.
The container refuses to start and give me access to the shall I expect.
Running the following command (as mentioned in the guide) does nothing, the process exits with a non-0 exit code. The first time I ran it, it downloaded the container image but did not land me into the sell as the guide says it would.
$ docker run --name opendata-2010 -it cmsopendata/cmssw_4_2_8 /bin/bash
I can see the container, it exits soon as it starts.
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
be670158d200 cmsopendata/cmssw_5_3_32 "/opt/cms/entrypoint…" 34 minutes ago Exited (139) 3 seconds ago opendata
These are other things I have tried to no avail.
$ docker exec -it be670158d200 /bin/bash
Error response from daemon: Container be670158d200ae85871fbda810fa6074dcb7bc8fc606f000710f630add1b80b6 is not running
$ docker start --attach be670158d200
failed to resize tty, using default size
My question is similar to this: Docker - Container is not running, but I know that unlike in that question, here I should be getting the shell.
I am running this in Windows Subsystem for Linux 2 - Ubuntu 20.04, docker version 19.03.8 - build afacb8b7f0. Any help is greatly appreciated, thanks.
I had the same error with below logs
dockerd[15309]: time="2022-01-11T11:13:35.133154132+05:30" level=error msg="Handler for POST /v1.41/exec/94553dc2f9aaa3c1245df7384138786a8a576af99105a285258fce8b980b4660/resize returned error: timeout waiting for exec session ready"
This is a bug in docker 20.10 version and can be solved by downgrading containerd rpm
Removed:
containerd.io.x86_64 0:1.4.4-3.1.el7
Installed:
containerd.io.x86_64 0:1.4.3-3.1.el7
I've read the command for docker kill. Now exactly how to stop
all containers or kill the container?
Should I navigate to the Docker folder in program files in cmd, or should I navigate to botium folder which I created for botium box in cmd? Currently I have Docker desktop version.
I'm getting the below error:
I restarted the Docker desktop app
Cmd : navigated to botium folder which I created for botium box
entered : docker-compose -f docker-compose-all.yml up
Error was thrown
C:\Users\Ram\Documents\Botium>docker-compose -f
docker-compose-all.yml up Starting botium_redis_1 ... botium_mysql_1
is up-to-date Starting botium_prisma_1 ... error
ERROR: for botium_prisma_1 Cannot start service prisma: driver failed
programming external connectivity on endpoint botStarting
botium_redis_1 ... error lready allocated
ERROR: for botium_redis_1 Cannot start service redis: driver failed
programming external connectivity on endpoint botium_redis_1
(023c3f7d0101a509a677a2f5434b00f25a8e4d3e238166eae6e0c1678b81035b):
Bind for 0.0.0.0:6379 failed: port is already allocated
ERROR: for prisma Cannot start service prisma: driver failed
programming external connectivity on endpoint botium_prisma_1
(1ad423ca349cd5d987a082407c64c8300e2822a0e4c3bf6a63c4369705f1413a):
Bind for 0.0.0.0:4466 failed: port is already allocated
ERROR: for redis Cannot start service redis: driver failed
programming external connectivity on endpoint botium_redis_1
(023c3f7d0101a509a677a2f5434b00f25a8e4d3e238166eae6e0c1678b81035b):
Bind for 0.0.0.0:6379 failed: port is already allocated ERROR:
Encountered errors while bringing up the project.
However when I retried the http://127.0.0.1:4000/quickstart a couple of times
the botium box opened. But initially this was not opening.
You don't have to navigate.
If you run using docker-compose, you can go to the directory where your docker-compose.yml file is located and run docker-compose down.
Without docker-compose, you have to run docker ps to list all currently running containers and find the name of the container to kill. You can use the CONTAINER ID or the NAMES. Then run docker kill <container name>.
Example:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
myId myimage:2.5 "/opt/command/ba…" 24 hours ago Up About an hour 0.0.0.0:9000->9000/tcp very_cool_name_1
$ docker kill very_cool_name_1
very_cool_name_1
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
$
Just type below commands when you open your Powershell or Bash.
To stop all running containers:
docker stop $(docker ps -q)
To remove all containers:
docker rm $(docker ps -qa)
Please note that rm will just remove your container not the Docker image. If your want to delete an image then you can use: docker rmi -f container_id
we are getting this error while trying to run docker commands. E.g.:
$ docker image ls
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.38/images/json: dial unix /var/run/docker.sock: connect: permission denied
So we followed the steps here but the problem remains. Then we saw this question where it is advised
You have to restart the docker daemon, otherwise it won't let members
of the docker group to control the docker daemon
but are having trouble restarting the service
$ sudo service docker restart
Failed to restart docker.service: Unit docker.service not found.
we are using
$ docker -v
Docker version 18.06.1-ce, build e68fc7a
on
$ uname -a
Linux jnj 4.15.0-1036-azure #38-Ubuntu SMP Fri Dec 7 02:47:47 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
the docker group has been successfully created and we are member of it
$ grep docker /etc/group
docker:x:1001:siddjain
Also we did log out and log back in. we are able to run docker commands with sudo. Also
$ sudo snap services
Service Startup Current Notes
docker.dockerd enabled active -
can anyone help us?
The solution was to restart docker daemon using snap (since that is how we installed docker)
siddjain#jnj:~$ sudo snap stop docker
Stopped.
siddjain#jnj:~$ snap start docker
error: access denied (try with sudo)
siddjain#jnj:~$ sudo snap start docker
Started.
After that we are able to run docker commands without having to sudo
siddjain#jnj:~$ docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
siddjain#jnj:~$
Our joy was shortlived as we immediately ran into another error after this one when we tried to run another container.
mkdir /var/lib/docker: read-only file system
To fix it we had to uninstall and reinstall docker again - this time from the official documentation as described here
I need to look up into docker logs for some days ago and checking by docker service logs SERVICE | grep WHAT_I_NEED takes forever so I want to download the container logs from docker swarm and check those locally. I found that the container logs in Swarm can be found by:
docker inspect --format='{{.LogPath}}' $INSTANCE_ID
but I can't find a way to download the log from the location.
Doing: docker cp CONTAINER_ID:/var/lib/docker/containers/ABC/ABC-json.log ./ tells me that the path is not present. I understand that this path is in Swarm but then how to get the log from the container itself? Or is there another way to copy this file directly to a local file?
Try running this one from your terminal:
docker logs your_container_name 2> file.log
This will redirect the container logs to the local file file.log
From my mac, successfully install Boot2Docker and everything seems to work well...
However when I try to pull a remote private repository using the following command:
sudo docker pull xxxx/yyyy I get this error message:
FATA[0000] Post http:///var/run/docker.sock/v1.16/images/create?fromImage=xxxx%2Fdev%3Alatest: dial unix /var/run/docker.sock: no such file or directory
When I try using this command docker pull xxxx/yyyy I got this error message:
Pulling repository xxxx/yyyy
FATA[0000] Error: image xxxx/yyyy:latest not found
Can anyone already experiment this error message from mac Boot2Docker ? Yes please let me know how to fix it.
Thanks.
Troubleshooting steps
Try restarting boot2docker
boot2docker restart
ssh into boot2docker boot2docker ssh and then see if the docker process is running ps aux | grep -i '/usr/local/bin/docker -d -D' | grep -v grep
Can you do a docker pull nginx from inside boot2docker? This is to test if docker daemon is functional from inside the boot2docker VM
Check if the docker daemon unix socket file exists inside the boot2docker VM ls /var/run/docker.sock
These steps should help you figure out whats wrong.