Trying to start the kubernetes in Docker-Desktop but it's stuck - docker

Update
The issue is resolved.
I shutdown docker desktop.
Deleted C:\ProgramData\DockerDesktop and .kube folder
Restarted docker desktop
reset docker desktop to factory defaults
and restarted it again and it worked.
I have started learning Kubernetes and Dockers yesterday. I installed Docker-Desktop today and my docker container is running. When i check the enable kubernetes option on Docker-Desktop it's not running. It just shows me a loading and below it just shows kubernete starting.
Photo of my Docker Desktop
What i have tried:
Uninstalling Docker Desktop and reinstalling it
Reset Kubernetes Cluster
Reset to Factory default
I have tried other solutions too which i found here on stackflow like:
Running it as an Administrator
Run this on powershell and then try to start kubernetes
[Environment]::SetEnvironmentVariable("KUBECONFIG", $HOME + "\.kube\config", [EnvironmentVariableTarget]::Machine)
But None of the solutions is trying to fix the problem im having.
Addition Information:
Im running Docker Desktop on Windows 10 pro
Docker Version: 2.2.0.5 Kubernetes version: v1.15.5

I fixed it!
I deleted the config file i.e ~/.kube/config then I uninstalled the app through the Troubleshoot window. I reinstalled and enabled kubernetes which required the internet to download the necessary files and after a while kubernetes was running. I believe its due to the internet connection during the installation of kubernetes files that causes problems.

Your update is right. That's what worked for me (on Windows 10) :
Shutdown Docker Desktop
Delete .kube folder (path : C:\Users\YourUserName\.kube)
Restart Docker Desktop
Reset Docker Desktop (press the scarab button (or also, debug or troubleshoot button) and click on "Reset to factory defaults")
Shutdown Docker Desktop
Restart Docker Desktop
Now, in the settings and in Kubernetes tab, Enable again Kubernetes (Check "Enable Kubernetes" option)
That's what worked for me and hope it's gonna be useful for you.

Just follow these steps
stop docker for desktop
remove the folder ~/Library/Group\ Containers/group.com.docker/pki
rm -rf ~/Library/Group\ Containers/group.com.docker/pki
start docker for destkop
Found the solution here
And given that every time I try to start "Docker for Desktop" Kubernetes get stuck, to better investigate for me was useful remove the kube autostart from the configuration.
Just edit the file:
~/Library/Group\ Containers/group.com.docker/settings.json
And change kubernetesEnabled value to false

Steps to follow :
Quit Dockerdesktop
remove ~/.kube/config
And ~/.kube/cache/*
restart start the docker desktop.
If you are behind a corporate vpn. then make sure you are able to configure proxy for the internet access in docker destop in preferences->Proxy. or you can disconnect from vpn and let the kubernates cluster setup for the first time. After that you can configure the proxy.

Related

Docker container Ubuntu SSH access

I installed a new docker container (the standard Ubuntu latest version).
I would like connect on it trough SSH access. I followed instructions on this excellent link https://linuxconfig.org/how-to-connect-to-docker-container-via-ssh
Once I stop my container and restart it, SSH service is not available anymore.
I have to start it manually anytime.
I tried this command too "systemctl enable ssh" to configure ssh as permanent.
The result is as followed:
"Synchronizing state of ssh.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable ssh"
So everything seems be ok, but when I stop the container and restart it, the problem is still present, no ssh service started on the ubuntu.
Someone knows how to configure SSH access as permanent on this case?
Thank you all by advance for your help :)
You have to write a customized Dockerfile, and inside it instrument the SSH configuration so, each time you run the container, it will have a working SSH daemon.
About the issue that when you rerun the container it loses the SSH configuration is caused by the fact that you a craeting a new container from the original (non SSH configured) Ubuntu image. If you want to run the configured container you have to get the containers lsit by docker container ls --all' and copy the ID, the run the container by docker run {{ID}}`.

VSCode ACI deployed Docker containers not showing in sidebar

I am new to working with containers, and was doing the docker/vscode tutorial (https://learn.microsoft.com/en-us/visualstudio/docker/tutorials/deploy-to-cloud).
The following issue has arisen during deployment (Step 9 of tutorial):
Containers deployed to Azure Cloud Instances do not show up in the sidebar.
Instead it says: "Failed to connect. Is Docker running?" and "Error: 14 UNAVAILABLE: No connection established"
This is counterintuitiv, as deployment via VScode actually worked.
Docker seems to be correctly installed:
$ docker -v
Docker version 20.10.2, build 2291f61
and the container is running:
$ docker ps
CONTAINER ID IMAGE COMMAND STATUS PORTS
agitated-newton leopkcode/getting-started Running <IP>:<PORT>
so why are running container instances not showing up in the left sidebar of the Docker extension?
I am running VSCode on WSL2.
I can reproduce this issue, the problem is that your docker engine or Docker Desktop on Windows is not running. See Install Docker Desktop on Windows.
Once the docker desktop is running and refreshes the containers in the VS docker extension. The ACI will display in the left sidebar of the Docker extension.
As pointed out by #Nancy Xiong, the issue must have been related to the local Docker installation. The exact nature is unclear, as I had made sure that both Docker engine and Docker Desktop were installed and running. Nonetheless:
Re-installing Docker Desktop Desktop (not Docker Engine) did solve the issue.

Docker does not autostart every time

Running Ubuntu desktop as server as a VM on ESXI and have Docker running there and Home assistant.
The problem is - When power source breaks, the machine autorestarts, VM reboots, but docker does not always boot up and Home assistant doesn't work either.
When I type in
sudo docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running
Then I got to ESXI - hit restart and all works like a charm.
What can it be guys?
You need to enable the docker service to run it automatically when the system restarts. The command is:
sudo systemctl enable docker
thank you, i tried that and got this line
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
i guess this should help me out.
but i still don't understand why it autostarted sometimes, and sometimes not

Docker in WSL2: Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?

I am currently running a Debian Distro (The default one from the Microsoft Store) on WSL 2 and I am having a lot of trouble with running Docker on it. My OS currently is Windows 10 Education Insider Preview, version 2004, and the os build is 19587.1000 and I have Docker Desktop.
Now, at this point, I've literally tried everything. I have tried using the "Expose daemon on tcp://localhost:2375 without TLS" way to no result. Then, I tried enabling "Enable the experimental WSL 2 based engine" (this is also why I had to move to Windows 10 education and get docker desktop and move to this version 2004).
I have also commented out "#export DOCKER_HOST=tcp://localhost:2375" from my .bashrc.
And then since WSL does not support systemd nor systemctl, starting docker using these are useless, and thus I tried "sudo service docker start" and also "sudo /etc/init.d/docker start". But, still when I run any command in Docker in my WSL, it gives me this:
$ docker ps -a
Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?
I just can't seem to figure out what is wrong...
I've looked up everywhere, tutorials, forums, other questions on StackOverFlow.
Most are either about Docker on Native Linux or on WSL 1 where they use the first method of exposing the daemon on tcp://localhost:2375 without TLS which is not very secure, but I didn't even get that working on mine.
Please help! It would be greatly appreciated!!
Thanks in advance!
https://github.com/docker/for-win/issues/5096
Make sure youve upgraded your wsl distro to v2 by checking wsl -l -v in windows powershell
In docker settings, Use the WSL 2 based engine & Enable WSL integration for your distro
But what finally fixed it for me was overriding the DOCKER_HOST env variable left over from using WSL1
export DOCKER_HOST=unix:///var/run/docker.sock
You can execute this line to test and then add it to your .bashrc and make sure its not getting set in .bash_profile or.profile
You should then be able to run docker ps successfully
Ok so basically I installed a clean WSL. This time I got a clean Ubuntu, and somehow it fixed the issue. My other WSL distros still won't work with this, but this clean Ubuntu does. However, as soon as I installed some stuff on it, it started breaking again. Now, I reinstalled it and now it works fine. Seems like something could be potentially conflicting with this?
Okay, I am using WSL2 + Ubuntu + Docker Desktop. What fixed the issue for me waschecking the option "Expose daemon on tcp://localhost:2375 without TLS" in Docker Desktop.
I had a similar issue on Debian, which was strange, as I had a running instance of OpenSUSE connecting to and using docker without problems.
In my case the reported error was
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
WSL2 Integration was enabled for both instances.
What eventually worked was the following:
From within both WSL Debian and WSL.exe - unset DOCKER_HOST
Restart Docker... (right-click on the Docker Dashboard icon in Task Bar)
Try any docker command again or just plain docker ps
There is an option for exposing the daemon on tcp://localhost:2375 without TLS, however it is unchecked by default, and I left it that way.
Enabling virtualization technology in the bios settings worked for me.

Docker run connection timeout

While running
sudo docker pull centos
it gives connection time out, While it is running behind proxy where the proxy has been set http_proxy & https_proxy. What is the reason apart from proxy,though it seems proxy issue.I checked LINK but in vain, is there some other settings i am missing please let me know.
2014/11/10 23:31:53 Get https://index.docker.io/v1/repositories/centos/images: dial tcp 162.242.195.84:443: connection timed out
I was getting timeouts on Windows 10 Docker 17.03.0-ce-rc1
To fix it I opened Settings / Network and then set the DNS server to 8.8.8.8
If you are running behind proxy then,
add following command or line in /etc/default/docker file,
export http_proxy=<YOUR_PROXY>
Restart docker service and check,
# service docker restart
service docker stop
HTTP_PROXY=http://proxy_ip:port/ docker -d &
This should work.
On Ubuntu, you can add HTTP_PROXY and HTTPS_PROXY to /etc/default/docker
So yes, what worked for me at the end is setting the proxy, as mentioned by other answers.
I went to icon tray --> Right click on docker to windows --> Go to
settings --> set the proxy as ip:port
Please refer screenshot as below
To change for a fast, open and non-intrusive DNS on CentOS 7:
sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0
add the line:
PEERDNS=no
and
sudo vi /etc/resolv.conf
keep only the line:
nameserver 9.9.9.9
If you run into these docker pull timeout issues on Docker Toolbox running on Windows 10 Home and piggybacking off an existing Virtualbox installation, check to see if Virtualbox is separately open and if so, shut down running machines and close Virtualbox (one or more of those running machines within Virtualbox were created and are being leveraged by Docker Toolbox). This heavy-handed way of going about things worked for me
Generally the problem of connection timeout, I know why the internet output was restricted to download docker images from external repositories,
To check this you can try to download the image from another server or another machine with a different internet channel.
If you can send the image from scp use the command: sudo docker save -o /home/your_image.tar your_image_name. and use with this command sudo docker load -i your_image.tar

Resources