Cannot build docker image after run Minikube build-env - windows

I'm using Minikube in Windows 10 and I'd like to use locally built Docker images instead of images hosted in a registry, so, according this tutorial, I have to run next commands:
Use local kubernetes and images:
> minikube docker-env
The output is:
PS C:\WINDOWS\system32> minikube docker-env
$Env:DOCKER_TLS_VERIFY = "1"
$Env:DOCKER_HOST = "tcp://10.98.38.126:2376"
$Env:DOCKER_CERT_PATH = "C:\Users\MyUser\.minikube\certs"
# Run this command to configure your shell:
# & minikube docker-env | Invoke-Expression
To configure the shell, run this:
> & minikube docker-env | Invoke-Expression
After that, I need to build a new image:
PS D:\repos\test> docker build -t miImage:v1 .
And I have next error:
PS D:\repos\test> docker build -t miImage:v1 .
Sending build context to Docker daemon 8.62MB
Step 1/10 : FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build-env
Get https://mcr.microsoft.com/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
This is error is thrown since I configured it to use local images, is there any way to fix it?

it looks like the machine that you're using to build is unable to reach https://mcr.microsoft.com/v2/ to confirm that, try to send a simple GET to the URL
wget https://mcr.microsoft.com/v2/
if that's the problem, you can use a different machine to pull the image, then save it to a file and load it on the target machine.
#on a machine connected to internet
docker pull mcr.microsoft.com/dotnet/core/sdk:2.2
docker save mcr.microsoft.com/dotnet/core/sdk:2.2 > dotnetsdk2_2.tar
# download the file
# on the target machine
docker load < dotnetsdk2_2.tar
then your build should work without a problem using the local version of the image.

Related

How to Run ROS 1 / ROS2 in frdmrobotics/playground in Docker on Windows and Connect via VcXsrv

I am trying to run the frdmrobotics/playground Docker Image like in this tutorial.
And also Connect the Gui via VcXsrv.
I tried to pull the Image but already only got errors.
Also I have no idea how I should connect VcXsrv from inside the Image
The Problem with Pulling was solved by updating Docker for Windows by starting it and letting it search for an Update.
After a Restart I could Pull the image with docker pull frdmrobotics/playground.
For starting a Container of the Image
docker run -it frdmrobotics/playground
works, but from the Tutorial
cd to the desired development folder e.g.
cd c:/rosProgramming
and then use:
docker run -dt --name robot_env --restart unless-stopped -v %cd%:/root/workspace frdmrobotics/playground
That starts the Container which can then be connected to by using:
docker exec -it robot_env bash
For Connecting VcXsrv I found the Info that I had to set some things in the Image:
export DISPLAY=192.168.105.1:0.0
export LIBGL_ALWAYS_INDIRECT=1
The needed IP Address in that command I got via ipconfig, it is the one which is marked with "(WSL)".
After that when I started a Programm it Opened in my VcXsrv Instance
After that you can use:
cd /root/code/ros1
to navigate to the ros1 environment

docker system df - Error response from daemon

I am using Docker 3.3.1 on macOS Big Sur 11.3.
I get the following error message:
docker system df
> Error response from daemon: error getting build cache usage:
> failed to get usage for bm9...za9: stat
> /var/lib/docker/overlay2/r6y...dma: no such file or directory
What does not show anything is:
docker ps --all
What does not work, is:
docker-compose down
docker image prune
docker system prune -a
docker rmi {all images}
What can I do?
What solved it at the end was:
Open Docker dashboard
Select Clean / Purge data
Restart Docker (if not automatically done)

Error "Docker: invalid publish opts format " runing Graphviz docker container on Mac Os

I'm completely new to docker and am using it for the first time.
I have installed Docker Desktop for Mac OS and run the 'Hello-world' container successfully. I am now trying to run this 'omerio/graphviz-server' from https://hub.docker.com/r/omerio/graphviz-server (which is what I really want Docker for) and although the 'docker pull omerio/graphviz-server' command completes successfully:
devops$ docker pull omerio/graphviz-server
Using default tag: latest
latest: Pulling from omerio/graphviz-server
863735b9fd15: Pull complete
4fbaa2f403df: Pull complete
44be94a95984: Pull complete
a3ed95caeb02: Pull complete
ae092b5d3a08: Pull complete
d0edb8269c6a: Pull complete
Digest: sha256:02cd3e2355526a927e951a0e24d63231a79b192d4716e82999ff80e0893c4adc
Status: Downloaded newer image for omerio/graphviz-server:latest
the command to start the container (given on https://hub.docker.com/r/omerio/graphviz-server): 'docker run -d -p : omerio/graphviz-server' gives me the error message:
devops$ docker run -d -p : omerio/graphviz-server
docker: invalid publish opts format (should be name=value but got ':').
See 'docker run --help'.
Searching for this error message returns no information at all. I see that the container in question was last updated over 3 years ago - could it be an old format that Docker no longer supports?
-p option of docker run command binds ports between host and container (see docs), and its usage is most of the time the following :
docker run <other options> \
-p <port on the host>:<port in the container> \
<my_image> <args>
As for your example : it seems that running the image needs an argument (the port in the container). Let's choose 8080 for example (that means port 8080 will be used by the application inside the container).
If you want to access it directly on your host (via localhost), you should bind 8080 port (in the container, the port we chose previously) to any available port on your host (let's say 8081), like this :
docker run \
-p 8081:8080 \
omerio/graphviz-server 8080
You should now be able to access the application (port 8080 of the application running in the container) from your host via localhost:8081.

docker deamon is not work in windows

I try to run docker in bash ubuntu on windows. But every time I get this message
"Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?". If i run it in powershell - it work. Can somebody help?
Connecting to the docker deamon requires some privilidges that you don't have when starting the bash terminal.
You can however use the docker command terminal which will allow you to interact with the docker deamon.
Found the solution on this post: https://blog.jayway.com/2017/04/19/running-docker-on-bash-on-windows/
Connect Docker on WSL to Docker on Windows
Running docker against an engine on a different machine is actually quite easy, as Docker can expose a TCP endpoint which the CLI can attach to.
This TCP endpoint is turned off by default; to activate it, right-click the Docker icon in your taskbar and choose Settings, and tick the box next to “Expose daemon on tcp://localhost:2375 without TLS”.
With that done, all we need to do is instruct the CLI under Bash to connect to the engine running under Windows instead of to the non-existing engine running under Bash, like this:
$ docker -H tcp://0.0.0.0:2375 images
REPOSITORY TAG IMAGE ID CREATED SIZE
There are two ways to make this permanent – either add an alias for the above command, or better yet, export an environment variable which instructs Docker where to find the host engine:
$ echo "export DOCKER_HOST='tcp://0.0.0.0:2375'" >> ~/.bashrc
$ source ~/.bashrc
Now, running docker commands from Bash works just like they’re supposed to.
$ docker run hello-world
Hello from Docker!This message shows that your installation appears to be working correctly.

Unknown Blob when pulling microsoft/xxxxx

I wanted to pull the the Docker image for Windows core/nano, docker pull microsoft/xxx to my local computer. The pull starts but it quickly ends with the error unknown blob
Same result for both of these:
PS C:\>docker pull microsoft/nanoserver
PS C:\>docker pull microsoft/windowsservercore
When trying to use images from Microsofts Docker repository "microsoft/xxx" you must ensure that you are running Docker with Windows containers, not Linux containers.
https://learn.microsoft.com/sv-se/virtualization/windowscontainers/quick-start/quick-start-windows-10

Resources