Run docker image with containerd - docker

I am trying to run the official docker Image to connect to the containerd sock instead of the docker sock. I don't see any option to make it connect to containerd.
The error I get:
│ error during connect: Get "http://docker:2375/v1.24/containers/*****/j │
The main use case is I am using this kubectl ssh plugin. It's working locally using docker sock which produces no issues, but when deployed to the EKS cluster. EKS uses containerd instead of docker.
I tried to search for a docker image with a predefined containerd sock

Related

Legacy Windows application in VC++, Docker Image is built. Problem while deploying the application in Docker Swarm with Docker Service Create command

I am using Docker on Windows 10 version 1903.
I have a Legacy Windows application in VC++.
I have built Docker image of the application and pushed to dockerhub registry.
I have created Docker Swarm with 1 Manager and 2 worker nodes.
I am trying to deploy the application in Docker Swarm by docker service create command but following error is displayed:
1/1: no suitable node (unsupported platform on 3 nodes)
I have already created docker swarm successfully with following commandline:
docker-machine create -d hyperv --hyperv-virtual-switch myswitch nodename
Set manager node.
Through following command I am trying to create service on docker swarm manager node:
docker service create --network myoverylaynet --endpoint-mode dnsrr --name servicename dockerimage
Is it possible to deploy a windows application(without GUI) to docker swarm manager node or only Linux applications can be deployed? How can I deploy my windows application to Docker Swarm?
I belive docker-machine creates Linux vms, not Windows vms. If you're running Win10, please see this blog post on how to create a Swarm:
https://stefanscherer.github.io/docker-swarm-mode-windows10/

Running docker inside Kubernetes with containerd

Since K8S v1.11 Runtime was changed from dockerd to containerd.
I'm using Jenkins over kubernetes to build docker images using Docker outside of Docker (dood).
When I tried to switch to use the socket file from conatinerd (containerd/containerd.sock was mapped ad /var/run/docker.sock) with the regular docker client a got the following error Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/containers/json: net/http: HTTP/1.x transport connection broken: malformed HTTP response "\x00\x00\x00\x04\x00\x00\x00\x00\x00".
Can docker client be used with containerd?
Disclaimer: as of this writing containerd didn't replace Docker, you can install containerd separately from Docker, and you can point the Kubernetes CRI to directly talk to the containerd socket.
So, when you install Docker it does install together with containerd and the Docker daemon talks to it. You'll see a process like this:
docker-containerd --config /var/run/docker/containerd/containerd.toml
However, the Docker client still talks to the Docker daemon, that's why when you run the Docker client in your container you still need to talk directly to the Docker daemon (/var/run/docker.sock), so you can switch back to /var/run/docker.sock and I believe it should work.
At least with MicroK8s 1.18 on Ubuntu 20.04, I found that a fix for this was to explicitly install Docker alongside Kubernetes.
Similar steps should apply to other Kubernetes distributions that don't include Docker.
After installing microk8s, you can do the following to install Docker:
# Shut down microk8s
sudo snap disable microk8s
# Assuming no Docker installed yet - this fixes the case
# where Kubernetes results in this path being a directory
rm -rf /var/run/docker.sock
sudo apt-get install docker.io
ls -l /var/run/docker.sock
# Output should show socket not directory:
# srw-rw---- 1 root docker 0 Aug 6 11:50 /var/run/docker.sock
# (See https://docs.docker.com/engine/install/linux-postinstall/ for usermod + newgrp commands at this point)
# Restart microk8s
sudo snap enable microk8s
Other Kubernetes distributions may have a different way to shut down processes more selectively.
journalctl -xe is useful to see any errors from Docker or Kubernetes here.
In Kubernetes manifests, be sure to use /var/run/docker.sock as the host path when mounting docker.sock.
Related issues:
hosting docker daemon alongside microk8s
cannot create socket because it's a directory
Post-install steps for Docker on Linux

Cannot access docker hub after eval of minikube docker env?

I am really confused, I had being learning kubernetes with minikube creating services and other things.
The problem comes in the following shape:
I run the following commands after a fresh install of minikube:
eval $(minikube docker-env)
The reason is because I want to get an image from my computer to be used with minikube. My understanding is that with this command I am in the same context for minikube and docker, so I can access my local images. "Please correct me if I am wrong here".
minikube start
So I get up and running the cluster, and ready to start creating things.
I want to pull the following container:
docker pull nginx/nginx-ingress
Because I want to try an ingress controller to work with my services.
But then I get this weird message:
Using default tag: latest
Warning: failed to get default registry endpoint from daemon (Cannot connect to the Docker daemon at tcp://192.168.99.101:2376. Is the docker daemon running?). Using system default: https://index.docker.io/v1/
Cannot connect to the Docker daemon at tcp://192.168.99.101:2376. Is the docker daemon running?
I run:
docker ps
And no results with a hang out.
I go to another terminal, I run the docker ps and it works like a charm.
Please if someone can bring some light to me of the impact of the command:
eval $(minikube docker-env)
And if you know why in my current Term with minikube running cannot access to my docker machine would help a lot.
minikube starts a dedicated virtual machine as a single-node Kubernetes cluster. If you have other Docker environments (a separate Docker Machine VM, the Docker Toolbox VM, the Docker for Mac or Docker for Windows environments, or a Linux-native Docker) these are separate from the Docker in the VM. You can't share images or containers between these environments.
If you have private images that aren't published to a registry, you'll have to re-docker build them when you switch to the Minikube environment. You otherwise don't specifically have to docker pull things that you're using, when you reference them in a Kubernetes pod spec Kubernetes will pull them for you.

Pulling image from local docker insecured Docker registry to Kubernetes

Cannot pull image from local docker insecured registry repository inside Minikube.
I'm running Docker-toolbox v1.12.2 using Linux VM (Upstart) installed on Oracle VirtualBox 5.1.6 under Windows 7.
I've created a docker image and push (tag and then push) it into a local insecured docker-registry v2 that running on 192.168.99.100:5000/image/name.
docker run -d -p 5000:5000 --restart=always --name registry registry:2
and inside the VM, on /var/lib/boot2docker/profile I've add to the EXTRA_ARGS the flag --insecure-registry 192.168.99.100:5000 .
docker push & docker pull from localhost:5000/image/name are working fine within Docker(VM).
_catalog is reachable from Postman :GET http:192.168.99.100:5000/v2/_catalog and I'm able to get the images inside the registry.
I'm starting my Minikube v0.15.0 VM with the command:
minikube start --insecure-registry=192.168.99.100:5000
I'm under company PROXY so I've added the proxy in the command line (CMD):
set HTTP/HTTPS_PROXY=my.company.proxy:8080 and set NO_PROXY={minikube ip}.
Then Kubernetes dashboard started to work for me.
Now for the real problem, when running the command:
kubectl run image-name --image=192.168.99.100:5000/image/name --port=9999
to pull image from my local docker registry into Kubernetes its saying
deployment "image-name" created
But inside Kubernetes > Deployments I'm getting the following error:
Failed to pull image "192.168.99.109:5000/image/name": image pull failed for 192.168.99.100:5000/image/name:latest, this may be because there are no credentials on this request. details: (Error response from daemon: Get https://192.168.99.100:5000/v1/_ping: Tunnel or SSL Forbidden)
Can anyone help here with that Tunnel or SSL Forbidden error, it's driving me crazy, and I've tried so many solutions to configure --insecrue-registery inside docker, inside Kubernetes or when running the dokcer-registry.
BTW why it's refering to v1/_ping? i'm using the docker registry v2.
Seems like minikube cannot see the same network that your registry is running. Can you try running minikube ssh then run your curl for the catalog?
Also, as an alternative, you could run eval(minikube docker-env) which then will set your local docker client to use the docker server inside minikube.
So for example if you built an image tagged with myimage/foo it would build and put that image on the minikube docker host, so when you deployed the image, it wouldn't need to be pulled.

Connecting the Docker Daemon insde the CDK on RHEL based docker images

I want to use the docker command line tool as in "docker ps", "docker build" and "docker run". How can I connect "docker" to the Docker Daemon inside the CDK, so I can create RHEL-based Docker images?
Use the vagrant-service-manager plugin to set up your host environment for connecting your client Docker binary (docker) to the Docker service running inside CDK. In the directory with the Vagrantfile you used to launch CDK, run:
eval "$(vagrant service-manager env docker)"
This will export environment variables that instruct the docker binary to connect to CDK.
To display info about the services running inside CDK and about the necessary settings to connect to the from your host (i.e. to see what the first command does), run:
vagrant service-manager env
See documentation for details: Using the vagrant-service-manager Plugin.
If you don't already have the docker client binary installed on your host system, vagrant-service-manager can do it for you:
vagrant service-manager install-cli docker
More details in documentation: Preparing Host System for Using Docker from the Command Line.
Just like using the docker binary to connect to the Docker daemon inside CDK, you can use the oc binary to connect to the OpenShift service running in CDK. Installation and set up is analogous to the docker client.

Resources