how to run docker commands in my windows command prompt? - docker

I am running docker commands in the docker quick start terminal. I need to run those commands in my windows terminal. When I check the version of docker, It shows correctly but when I run docker ps or other docker commands. It shows like :
C:\Users\rajasekar.sambandam>docker ps
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.29/containers
/json: open //./pipe/docker_engine: The system cannot find the file specified.
In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.

On Windows, docker runs in the background in an linux VM. The quick start terminal delegates all the calls to the VM, and thats why the docker commands work.
When running from a normal terminal, run the command:
eval $(docker-machine env default)
This command will connect the current terminal to the backgound machine.

Related

Ubuntu test container (ryuk) unable to connect to docker daemon despite docker desktop runnning

I'm getting the following error when I try to run test container in my java app from the IDE:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
however docker desktop is running.
Also I am getting the same error when I run the testcontainers/ryuk image directly from docker desktop by clicking the run button in the images panel.
But the container runs when I use the following command in the terminal:
docker run -i --mount type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock testcontainers/ryuk:0.3.4
EDIT:
the test container works when I installed docker engine cli and use it as the active context but it's a hassle switching. It seems the default bind being used is cli.
EDIT2:
I've uninstalled and purged every docker installation and reinstalled only docker desktop and it's still the same, on a windows machine it's working properly though.

Openshift (oc) login to registry keeps on failing - how to start the Docker daemon?

After starting a command prompt, I normally start with login in to openshift with this command:
$ oc login https://api.starter-us-west-1.openshift.com
--token=
Works fine. Up till now I then connected to the docker registry of Openshift with the command:
$ docker login -u myOpenShiftName -p registry.starter-us-west-1.openshift.com (or :443)
Now I get this error (partly translated):
Warning: failed to get default registry endpoint from daemon (error
during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.37/info:
open //./pipe/docker_engine: The system cannot find the specified
file. In the default daemon configuration on Windows, the docker
client must be run elevated to connect. This error may also indicate
that the docker daemon is not running.). Using system default:
https://index.docker.io/v1/
Do I need a local docker running?
UPDATE/ANSWER: yes. On windows10 home start e.g. DockerQuickstartTerminal.
At another computer I had a similar error on Windows 10 pro with Docker. The service was started, but after I had started "Docker for Windows" the error disappeared.
My environment is Win10 home, virtual box + extension + docker toolbox.
The docker command cannot work without its local Docker daemon process running.
If you want to be able to work with OCI/Docker images and not need docker and the daemon, for some things you can use a tool like Skopeo.
https://github.com/containers/skopeo
There are also tools for building OCI container images which aren't dependent on docker.

Docker on windows error related to daemon

I am trying to install Docker Tools on Windows 7 laptop, installed Docker using Windows Docker Tools.
When I run docker run hello-world I get the below error. I have already removed the VM, and recreated it. Also, I am using a VPN.
Please let me know what steps should I try next.
C:\Program Files\Docker Toolbox\docker.exe: error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.35/containers/create: open //./pipe/docker_engine: The system cannot find the fi daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running. See 'C:\Program Files\Docker Toolbox\docker.exe run --help'.
Try restarting the docker service using below on cmd-prompt:
Net stop com.docker.service
Net start com.docker.service
or restart the Docker for Windows service through the Windows GUI by right clicking the service and choosing restart
Have a look at this article on success.docker.com

docker create service unavailable

I am behind a corporate firewall, running on Windows 7. I believe that I have gotten past any proxy issues (at least as far as accessing the container for which I'm trying to install.)
At this point I'm trying to execute docker's run command which 'acquires' the tensorflow package an installs it on my system.
$ docker run -it -p 8888:8888 gcr.io/tensorflow/tensorflow
C:\Program Files\Docker Toolbox\docker.exe: An error occurred trying to connect:
Post https://192.168.99.100:2376/v1.23/containers/create: Service Unavailable.
See 'C:\Program Files\Docker Toolbox\docker.exe run --help'.
I'm new to docker, (obviously) but I see that the 192.168.99.100 default docker container exists and is running.
I do see documentation regarding the 'create' service endpoint. I'm at a dead end. Any help is appreciated.
-gene
when you type docker command docker client try to connect with your local docker service. And in linux world you need a superuser privileges to connect client and service.
I don`t run docker on windows, but may be you need run docker as Administrator. like linux
sudo docker run ...

What does Docker Quickstart Terminal do?

I just recently started using Docker. I'm able to run my servers, and communicate between them.
What I don't understand is: why do I need to run Docker commands, like $ docker run somerepo/image from the window opened by Docker Quickstart Terminal.
Running it from "regular" Terminal windows returns
$ docker run dockerinaction/hello_world
docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?. See 'docker run --help'.
I understand that on OS X and Windows, Docker needs to start one virtual machine with Linux 2.6 (in my case), and that all containers are run within that VM.
I thought docker CLI was connecting to a docker deamon that runs inside that VM - and then I don't understand what happens in the Quickstart Terminal.
I don't understand what does happen in the Quickstart Terminal.
You can use a regular terminal, provided by docker-machine env, and do operations similar to osx/mpkg/quickstart.app/Contents/Resources/Scripts/start.sh:
dockerm-machine start dev
eval "$(docker-machine env dev)"
(replace 'dev' with the name of your docker machine. By default, it is named... "default")
Once those environment variables for the Docker client are set, you can execute docker command directly from your shell.
A Quickstart Terminal would set those same variable for you.
You can see what it does by watching the terminal output. In my case it ran bash --login '/Applications/Docker/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh' attempting to start the virtual machine. Once it's running it uses the equivalent of eval "$(docker-machine env default)" to set some environment variables so your terminal is ready to access the Docker VM.
If you need more information have a look at that script start.sh.
What does docker quickstart terminal do?
From Docker docs:
It will create and start a VirtualBox VM running Docker Engine, then
configure the command-line environment so that you can talk to it
In other words it sets some environment variables so your terminal is ready to access the Docker VM. - (thanks to #Nauraushaun)

Resources