Can't remove or stop a container - docker

The docker version is 0.10.0, the linux system is Centos6.5.
Three containers have been running in the system for 3 months in OpenStack. I put the nova-compute service in a container.
I found that nova-compute container didn't work recently.
I delete the json.log of the container when I found the log is 3GB,
but it still does not work.
I try to delete,stop,restart the container,restart the system,it's still the same.
dockerctl 6a82f22d2dad
lxc-attach:failed to get the init pid
docker rm -f 6a82f22d2dad
Error:
2015/08/11 08:51:32 Error:failed to remove one or more containers
docker stop 6a82f22d2dad
Error:failed to stop one or more containers
When running docker ps, the compute container works well.
Now I could not get other information because I can't connect the remote machine. Has anybody the same problem?

Redhat has come right out and stated that they do not support Docker on CentOS 6.x systems.
If you can, I suggest you upgrade to CentOS 7 and the latest Docker version.
You can find more info about CentOS 6.x Docker support here

Related

Docker Desktop can't get container logs

I'm using Docker Desktop on Win10. Containers works correctly and when I start container without -d parameter I see logs in cosnole output. Also when I use command docker logs I can see the logs. Unluckily when I try to get logs from Docker Desktop Logs tab I see:
No such container: fb1c4bd5bc56031edb44e0c2e1e4ebd5c281f1a2d96bbc2b16249154e0c2d013
I tryed reinstall Docker Desktop but it doesn't help. This problem appeard a couple month ago , actually I have the newest (4.12.0) version.
Any ideas how to fix this?
Try deleting all execting containers and volumes with :
docker system prune
https://docs.docker.com/engine/reference/commandline/system_prune/
After that, reset your wsl distro.

Cannot start container: OCI runtime create failed: container_linux.go:349

I am using docker on my CentOS Linux release 7.8.2003 (Core) with 16 GB RAM. My docker version is Docker version 19.03.7. Docker-compose version is docker-compose version 1.23.2. I have 30+ docker containers running on my machine.
Everything was working smoothly, but I ran into a problem. Sometimes, when I try to run a container I get this error
ERROR: for container_name Cannot start service container_name: OCI runtime create failed: container_linux.go:349:
starting container process caused "process_linux.go:319: getting the final child's pid from pipe caused \"EOF\"": unknown
When I retry 3-5 times to run container, the container started successfully. Sometimes I need to restart docker service and my server to make it working. I don't know the exact reason why It is giving me this error sometimes and gets created successfully sometimes with same docker-compose file.
Can somebody explain this weird behavior of docker to me? Is it due to so many containers running on my machine or something else?
I had a similar issue:
OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:722: waiting for init preliminary setup caused: EOF: unknown
and the problem turned out to be the wrong version of my WSL distro, which was 1 instead of 2:
PS C:\Users\myself> wsl -l -v
NAME STATE VERSION
* Ubuntu Running 1
So I used the wsl --set-version command to upgrade it:
PS C:\Users\myself> wsl --set-version Ubuntu 2
PS C:\Users\myself> wsl -l -v
NAME STATE VERSION
* Ubuntu Running 2
Then I was able to successfully build my Docker image.
Hope can help someone.
Came across this link, which solved the issue for me. It apparently works for WSL, but definitely also for my Ubuntu 18.04 installation: the latest version(s) of docker have this problem, a few versions back they haven't.
I am a complete newb to Docker and am running Linux 18.04.6 Bionic Beaver
docker --version reports Docker version 20.10.7, build 20.10.7-0ubuntu5~18.04.3
I'm not sure if this is the solution, but after reinstalling Docker from various unrelated problems I ran runc init and killed an old running dockerd process and was able to get hello-world to run. I've wasted so much time on it that I don't want to find the root cause.

Why am I getting a "Cannot connect to the Docker daemon" error in WSL2?

Here is my setup:
Windows 10 PRO - build 19041.153 - insider program - slow ring
Ubuntu 18.04LTS subsystem in WSL2 mode
Docker for desktop 2.2.0.4 - enabled WSL2 integration with my Ubuntu subsystem
I am currently forced to use Windows for development, so I became a
Microsoft insider member and installed ubuntu with WSL2 mode. Docker desktop supports integration for WSL2, so I tried it...
For a week it worked flawlessly. Today after a PC restart, I can't get docker running again. Ubuntu can see the injected binaries from Docker desktop, but it can't connect to windows hosted docker daemon anymore.
When I call in the WSL terminal docker info it returns
$ docker info
Client:
Debug Mode: false
Server:
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
errors pretty printing info
or with docker-compose up
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
What I've tried already:
expose daemon without TLS with envs like DOCKER_HOST=localhost:2375, DOCKER_HOST=tcp://localhost:2375, DOCKER_HOST=127.0.0.1:2375, DOCKER_HOST=tcp://127.0.0.1:2375 => same result
uninstall Docker desktop and install previous version
turn off windows firewall
I really, really need this to work. Thanks for any ideas. Weirdest thing is it worked yesterday and I didn't make any changes in system from then...
I know this may be outdated for the present question, but this should save us precious time, especially when Windows 20H1=2004 is going to Production this month (May 2020).
  Operating System Version: Windows 10 Education (Same as Enterprise and a superset of Pro).
  Version: 2004
  Build (Version OS): 19041.264
  Others: Windows Feature Experience Pack 120.2202.130.0.
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Shell: WSL Terminal
First, I have installed WSL v1 previously, then executed the procedure to upgrade to WSLv2, and this error shows up: "ERROR: Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?".
Second, to fix that error, I followed instructions stated here: Link, and it worked.
Third, after some tests I think the missing change in the upgrade, was removing the DOCKER_HOST variable from shell's start script.
SUMMARY: In my case, the procedure for a permanent fix should be the following STEPs:
1. Test if it's your case unsetting DOCKER_HOST variable (See image below).
2. If the error disappears with previous step, then time to fix changes by removing the setting of the DOCKER_HOST variable in the shell's start script (In my case was *$HOME/.bashrc*).
  Commented this out:
  #export DOCKER_HOST=tcp://localhost:2375
  #export DOCKER_BUILDKIT=1
  NOTE: Also include DOCKER_BUILDKIT.
3. Close and open the Terminal.
  Test in Step 1:
Good luck!!
If it helps anyone else that is having this issue, for me it turned out that my subsystem was suddenly (and "on its own") ticked off in docker's RESOURCES > WSL INTEGRATION settings.
On the Docker Desktop app I had to manually enable my distro integration under
Settings > Resources > WSL Integration
I had installed Docker for Windows, as recommended, to use it with WSL 2 and that does indeed start the docker daemon for you. But I don't need all the fancy features it offers so removed it and was pleased to see about 4GB freed and no extra icon in the system tray.
Now if I need to run docker commands I just begin with:
sudo dockerd &
This way I can have it running on the background on the same shell. Note that in this example I have setup sudo without password. If a password is required, I can do sudo dockerd and open another terminal tab.
Although this works as a quick temporary solution I've seen it cause network issues so I would not recommend it, and prefer using a light VM instead.
I've tried soooo many things, and the stuff that worked for me, and no one ever mentioned to try:
(from Windows Powershell)
wsl --set-default <my-distro>
then and there, I could connect to docker without changing the DOCKER_HOST var.
1.open windows docker desktop --> Setting -->General --> Disable Expose daemon on tcp://localhost:2375 without TLS
2.and then Go to Settings --> Resources --> WSL integration --> uncheck Enable integration with my default WSL distro and turn off integration with distro
3.click apply and restart
4.then go to ubuntu
try docker ps
docker ps
if it does not work, continue to run the following command
unset DOCKER_HOST to disable DOCKER_HOST
Today I just tried it successfully
good luck to you
I have found my issue was due to mis-reading instructions., fixed on my windows version 1909 and WSL 2 with the following commands on CMD:
wsl.exe -l -v
wsl.exe --set-version ${distro-name} ${wsl version}
example:
C:\Users\xxxxx>wsl.exe -l -v
NAME STATE VERSION
* Ubuntu-18.04 Running 1
docker-desktop-data Running 2
docker-desktop Running 2
C:\Users\xxxxx>wsl.exe --set-version Ubuntu-18.04 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
That's it
ISSUE: Cannot connect to the Docker daemon at tcp://127.0.0.1:2375
Powershell
wsl -l -v # ALL DISPLAY "2"
Linux
unset DOCKER_HOST
/etc/init.d/docker restart
Restart Docker
windows docker restart
windows firewall off
Linux docker processes
docker ps
I had the same problem, the solution for me was to set my Ubuntu as the default wsl distribution: wsl --set-default Ubuntu
For whatever it's worth (this is an old thread). Maybe someone else is still desperately trying to solve this puzzle.
I have just stumbled over the solution in my case.
I am running the following
docker desktop version 3.3.3
wsl 2
Fedora 33
Over and over again I ran into this issue "Cannot connect to the Docker daemon at unix:///var/run/docker.sock". Reinstalled, restarted, blablabla.
My ultimate error were access rights on /var/run/docker.sock, and I am running wsl under my personal user
srw-rw---- 1 root docker 0 May 7 10:29 /var/run/docker.sock
So if I run as root (sudo docker info) or I put myself into group "docker" (sudo usermod -aG docker $USER) I'm all well. Please look here https://docs.docker.com/engine/install/linux-postinstall/
There is another very basic catch:
Ensure virtualization is enabled in the BIOS.
Please enable the Virtual Machine Platform Windows feature from the selection of additional Windows Features.
Now my motherboard is being very old, the BIOS does not support
Enabling Virtualization.
Hence no solution will work for me.
WSL Version 1 or 2 will come from Windows Update automatically.
After hours, my docker worked using following method.
Go to docker desktop --> Setting -->General --> Disable Expose daemon on tcp://localhost:2375 without TLS
Go to Settings --> Resources --> WSL integration --> uncheck Enable integration with my default WSL distro and turn off integration with distro
Restart Docker desktop
Now in WSL,
unset DOCKER_HOST
Now try,
docker ps
The accepted answer is mostly correct. However, I wanted to specify that when using WSL2 + Docker Desktop:
You must unset DOCKER_HOST which was previously needed in WSL1
Mine was defined in ~/.bashrc in both Windows and WSL.
Delete in both. Also delete in Windows env variables via Control Panel.
Check with env | grep -i docker to make sure it's gone.
You must also set the correct settings in Docker Desktop
Uncheck Export daemon on tcp://localhost:2375 without TLS
Check Use the WSL2 based engine
Resources -> WSL Integration -> Check Enable integration with my default WSL distro
Now, you can do a simple docker info to check if you're running the same server version in WSL and in Windows (Powershell).
you can consider upgrading your version to 19582.1000 , it's work for me.
See this issue.

Eclipse Che docker image fails to start on Synology DS

I have installed Dockers on my Synology DS. Then I downloaded the Eclipse Che image.
When I start the image, i keep seeing the following error in the logs.
!!! Docker socket (/var/run/docker.sock) hasn't be mounted inside the container. Verify the syntax of the "docker run" command.
The following are screenshots of the configuration of for the image. How do I get the container image going? Any help is fixing this problem will be much appreciated.
What Che image are you trying to run?
Last version, which supported docker deployment was Che 6. Current version is 7.x, but since 7.x support of docker has been dropped and Che is supposed to run on k8s clusters.
But even if we are talking about Che6, Che server (the image you are probably trying to run) needs to have capability to connect to host docker daemon to spawn new containers (each workspace will be its own new container).
This is why, when starting che, you need to mount /var/run/docker.sock.
So the usual comand to start che in Che6 days was something like this:
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v <path>:/data eclipse/che start

Failed to start docker on an Amazon linux machine

I am using an Amazon linux machine (p2).
I have installed this docker version:
Client:
Version: 17.03.2-ce
API version: 1.27
Go version: go1.7.5
Git commit: 7392c3b/17.03.2-ce
Built: Wed Aug 9 22:45:09 2017
OS/Arch: linux/amd64
I'm not sure, but I think the issue started after killing a screen which ran some docker container
I'm experiencing this error:
sudo docker ps
Gives:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
And:
sudo service docker status
Gives:
docker dead but subsys locked
I have tried both:
sudo rm -rf /var/run/docker
sudo rm /var/run/docker.*
I also tried to restart and stop:
sudo service docker start/stop
I also rebooted the EC2 machine
Try this and restart docker
yum update device-mapper-libs
sudo service docker restart
I am also facing the same issue. Although I (sort of) fixed it by issuing sudo service docker stop and sudo service docker start before running anything in docker.
Details: I am using docker in a spot instance, so it is setup everytime I need to perform some task. I create the docker and upload my files without any problem. But when I issue the command to run an uploaded bash script in docker I face this issue of docker not running. So before running the script I just stop and start docker. Weirdly, simply doing sudo service docker start or even sudo service docker restart did not solve my problem. I had to specifically issue both start and stop commands. But I don't have enough data points just yet, it is only working from the last couple of days and I am not in a hurry to test this hypothesis (of issuing both commands and not just one).
I had 10 docker containers running an ec2 instance(t2.large), each instance was running on its own service and the whole services are running in a cluster. I updated the timezone of the ec2 instance machine, this required me to reboot the instance. I rebooted the instance, this problem surfaced. First thing I noticed was that ssh into the machine was slower than before, I later realized docker ps was throwing that error, I magically resolved that later to realize that some of the container instances are running but they are not serving any page docker logs -f CONTAINER_ID let me know nginx didn't start due to privilege issues that some of my files that supposed to be created were not created.
I later realized that my magical solution was a really magical solution(most magical solutions are not solutions), all my 10 containers were trying to start at the same time which required more memory space than space my instance could offer, I later had to delete services and recreate them one by one - allow one container to start before creating another one in the same cluster. That was when I had peace. I hope this help somebody.

Resources