Cannot install TensorFlow on Docker Windows - windows

When installing Tensorflow on Docker Tools on Windows, I got this error
docker: An error occurred trying to connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.23/containers/create: open //./pipe/docker_engine: The system cannot find the file specified..
See 'docker run --help'.
How to solve this issue?

I followed steps in this github issue.
Maksym#MaksymPC MINGW64 ~
$ docker ps
An error occurred trying to connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.23/containers/json: open //./pipe/docker_engine: The system cannot find the file specified.
Maksym#MaksymPC MINGW64 ~
$ docker-machine env default
Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.100:2376": tls: DialWithDialer timed out
You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
Be advised that this will trigger a Docker daemon restart which will stop running containers.
Maksym#MaksymPC MINGW64 ~
$ docker-machine regenerate-certs
Regenerate TLS machine certs? Warning: this is irreversible. (y/n): y
Regenerating TLS certificates
Waiting for SSH to be available...
Detecting the provisioner...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Maksym#MaksymPC MINGW64 ~
$ docker ps
An error occurred trying to connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.23/containers/json: open //./pipe/docker_engine: The system cannot find the file specified.
Maksym#MaksymPC MINGW64 ~
$ docker-machine env default
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="C:\Users\Maksym\.docker\machine\machines\default"
export DOCKER_MACHINE_NAME="default"
# Run this command to configure your shell:
# eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env default)
Maksym#MaksymPC MINGW64 ~
$ eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env default)
Maksym#MaksymPC MINGW64 ~
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Then, you can run
docker run -it -p 8888:8888 gcr.io/tensorflow/tensorflow

Related

How to launch LXD container in WSL2?

I've set up wsl 2:
PS C:\Users\User> wsl --list --verbose
NAME STATE VERSION
* Ubuntu-18.04 Running 2
However when attempting to create a container from wsl the following error is returned:
$ lxc launch ubuntu:18.04 test
Error: Get http://unix.socket/1.0: dial unix /var/lib/lxd/unix.socket: connect: no such file or directory
How to launch an LXD container from wsl2? From my understanding it should be possible given that wsl2 is a full linux kernel.
Adding sudo before the command works.
This needs to be done for every command of lxc/lxd.

Cannot connect to the Docker daemon when running with sudo

My Docker service is up and running. However when attempting to use Docker by running it with sudo, e.g.:
12:40:26/~ $ sudo docker pull fluxcapacitor/pipeline
Using default tag: latest
I have got the following error:
Warning: failed to get default registry endpoint from daemon (Cannot connect to
the Docker daemon. Is the docker daemon running on this host?). Using system
default: https://index.docker.io/v1/
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
Note that I had already followed the answers on Mac OS X sudo docker Cannot connect to the Docker daemon. Is the docker daemon running on this host?
as follows:
docker-machine start default
12:40:36/~ $ docker-machine start default
Starting "default"...
Machine "default" is already running.
docker ps
12:41:20/~ $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
So what more needs to be done?
This is:
$ docker --version
Docker version 1.11.2, build b9f10c9
on El Capitan.
Output of docker-machine env default
$ eval "$(docker-machine env default)"
$ docker-machine env default
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="/Users/macuser/.docker/machine/machines/default"
export DOCKER_MACHINE_NAME="default"
The following command exports a few environment variables that the subsequent docker commands use:
eval "$(docker-machine env default)"
However, if you launch docker with sudo, the exported environment variables are not accessible by the docker executable. You could potentially get it to work by passing -E flag to sudo, e.g.:
sudo -E docker pull fluxcapacitor/pipeline
But much easier option is to use docker without root like:
docker pull fluxcapacitor/pipeline
You have to set environment variables with:
eval "$(docker-machine env default)"
More about it here.
I had same probelem on my MAC, when attempted
# eval "$(docker-machine env default)"
got this error
Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.100:2376": x509: certificate is valid for 192.168.99.101, not 192.168.99.100
You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
to regenerate certificates, find out the docker-machines available;
# docker-machine ls
Output of avalable docker machines (omitted others)
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default - virtualbox Running tcp://192.168.99.100:2376 Unknown Unable to query docker version: Get https://192.168.99.100:2376/v1.15/version: x509: certificate is valid for 192.168.99.101, not 192.168.99.100
Generate certificates for this default docker-machine
# docker-machine regenerate-certs default
and then setup docker-machine env to default docker-machine;
# eval "$(docker-machine env default)"
and it works normally after that.
I have also tried the same but did not work.
later I have tried these steps on AWS CLI
$ sudo nano /etc/docker/daemon.json
{
"dns": ["8.8.8.8", "8.8.4.4"]
}
$ sudo service docker restart
$ docker pull hello-world

Can not run docker command directly after installation on windows

I installed docker on windows 10 with DockerToolbox (1.11.2) executable. However, I can't evaluate my environment using docker-machine env default directly.
Instead, only when I use this command
C:\Program Files\Docker Toolbox\docker-machine.exe env default *
Can I evaluate the environment?
When I want to check help information, I also have to run
C:\Program Files\Docker Toolbox\docker.exe run --help
In their official tutorial: Install Docker for Windows, they mentioned that after installation, I could use docker,docker-machine,docker-compose directly.
In fact, I found this problem when I met this error:
C:\Program Files\Docker Toolbox\docker.exe: An error occurred trying
to connect: Post https://192.168.99.103:2376/v1.23/containers/create:
dial tcp 192.168.99.103:2376: connectex: A connection attempt failed
because the connected party did not properly respond after a period of
time, or established connection failed because connected host has
failed to respond..
And I solved it by restart my machine, and evaluate it again with the full path of the executable.
Some thing interesting is that docker-machine create -d virtualbox default worked for me while docker stop $(docker ps -a -q) failed.
I can just add those executable to environment variable on Windows.
But I want to what's happaning to that installation which caused this problem.
Screenshot of my installation console:
First, you don't have to use docker-machine env at all: you can simply ssh to your machine, and make your docker commands from there.
docker-machine ssh default
Second, try and use those commands from a regular CMD session (you don't need a bash).
As documented in docker-machine env:
$ docker-machine.exe env --shell cmd dev
set DOCKER_TLS_VERIFY=1
set DOCKER_HOST=tcp://192.168.99.101:2376
set DOCKER_CERT_PATH=C:\Users\captain\.docker\machine\machines\dev
set DOCKER_MACHINE_NAME=dev
# Run this command to configure your shell: copy and paste the above values into your command prompt
(Replace "dev" by the name of your machine, like "default" for instance)

eval "$(docker-machine env default)" leads to Error checking TLS connection

I've installed Docker on my Mac about a month ago, and I now wanted to use it again. The command eval "$(docker-machine env default)" used to work perfectly before, but I now get an error:
Error checking TLS connection: default is not running. Please start it
in order to use the connection settings
I searched around for this error, but I can't really find anything about it. Does anybody know what I should do to solve this? All tips are welcome!
Your boot2docker virtual machine must be running inside Virtualbox.
List your Docker machines:
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default - virtualbox Stopped Unknown
Start default machine:
$ docker-machine start default
Starting "default"...
(default) Check network to re-create if needed...
(default) Waiting for an IP...
Machine "default" was started.
Waiting for SSH to be available...
Detecting the provisioner...
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.
To recreate your default machine:
$ docker-machine rm default
$ docker-machine create --driver virtualbox default
Then you should be able to setup your env with eval "$(docker-machine env default)".

How to export the docker variables?

I'm new to docker.My Operating system is Mac OS.
I follow the step from docker website,
Download the boot2docker and install it.
run the boot2docker
$ boot2docker init
$ boot2docker start
$ docker run hello-world
the result is that :
bash-3.2$ docker run hello-world
An error occurred trying to connect: Post https://192.168.59.103:2376/v1.19/containers/create: x509: certificate is valid for 127.0.0.1, 10.0.2.15, not 192.168.59.103
then i do
$ boot2docker shellinit to display the environment variables
bash-3.2$ boot2docker shellinit
Writing /Users/wangyao/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/wangyao/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/wangyao/.boot2docker/certs/boot2docker-vm/key.pem
Your environment variables are already set correctly.
maybe I think it makes error by not configuring the variables, So I do this
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=/Users/wangyao/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
then I $ boot2docker shellinit, and the result is no different,
Please tell me how to resolve it
I explained how to use Docker Machine instead of boot2docker, if you're interested: Can't run docker on os X with boot2docker.
Because I think Boot2Docker won't be the recommended way of using Docker (on Windows/OS X) any longer soon.
TL;DR
docker-machine create -d virtualbox dev
eval "$(docker-machine env dev)"
docker run hello-world

Resources