I'm trying to login to my AWS account with a docker loginstring from aws ecr get-login --region eu-west-1 -- however, when I do, I get this:
Warning: failed to get default registry endpoint from daemon (error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.26/info: 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.). Using system default: https://index.docker.io/v1/
error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.26/auth: 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
The peculiar thing is this was just working last week. I'm using Cygwin on Windows 10. I've verified that Docker is running in services.msc -- I'm not entirely sure what to check now.
If you want to run docker commands in cygwin on Windows 10, then call the following command from cygwin:
docker-machine env --shell=bash
It will show the environment variables needed by docker:
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.xx.xx:2376"
export DOCKER_CERT_PATH="C:\Users\...\machines\default"
export DOCKER_MACHINE_NAME="default"
export COMPOSE_CONVERT_WINDOWS_PATHS="true"
# Run this command to configure your shell:
# eval $(docker-machine env --shell=bash)
Run the following command to set the environment variables:
eval $(docker-machine env --shell=bash)
It looks like you are trying to open a pipe to the service by passing a windows pipe path to cygwin. It gets interpreted as an http path by cygwin.
This is probably happening because the docker command finds the cygwin python before it finds the windows python. There are several solutions. The simplest is to switch back to a windows context to execute the docker command. If docker is actually docker.bat then start it with cmd.exe /c docker.bat otherwise cmd.exe /c docker.exe. You may also try cmd.exe /c start /w /i docker.bat. Or some variation.
You do not want to execute any docker command directly in cygwin as it will likely not know how to translate between windows paths and the linux paths it expects.
Related
I installed docker and docker compose in ubuntu 18.10 server, when i execute the command docker compose from terminal it is working, but when i configure a crontab to exexute a command with docker compose, i get this error :"The USER variable is not set. Defaulting to a blank string.the input device is not a TTY"
The USER error is related to an error with docker-compose.yml, juste for using ${USER}.
How can i fix the issue ?
PS: It was working normaly in ubuntu 18.04 server.
The cron daemon was designed in such a way that it does NOT execute commands within your normal shell environment. This means you cannot use bare commands in cron the way you would from the SSH shell command line. This is because the PATH environment variable is /usr/bin:/bin, and the SHELL environment variable is set to /bin/sh.
Something you can reference: here and here.
So you may have to specify shell environment variable directly in crontab, like
USER=xxx
* * * * * /bin/echo ${USER}
I am trying to setup docker through WSL(ubuntu) on Windows 10 Home but ran into an issue when trying to use the docker-compose up command:
$ docker-compose up
ERROR: Couldn't connect to Docker daemon at http://localhost:2375 - is it running?
I have the following configuration in my ~/.bashrc file
#Insert new Path for Docker and Alias
PATH="$HOME/bin:$HOME/.local/bin:$PATH"
PATH="$PATH:/mnt/c/Program Files/Docker Toolbox"
alias docker=docker.exe
alias docker-machine=docker-machine.exe
// Other code
export DOCKER_HOST='tcp://localhost:2375'
docker-machine seems to be running fine as the docker ps command shows a list of containers.
From my research, if I were to use Docker for Windows (which does not run on Windows Home) ; I need to turn on the “Expose daemon on tcp://localhost:2375 without TLS” option in the settings. Since I am using “Docker Toolbox + VirtualBox”, I would like to ask what would be the equivalent?
Please let me know if you require further information.
This is a bit tricky because yo need to use two terminals : one in Windows and one in WSL.
What worked for me : I installed docker-machine and virtualbox on Windows. Then I created a virtual machine named default on virtualbox. Then on Windows, with the terminal Git bash for windows, I ran the following commands :
docker-machine start default : it starts the virtual machine. Alternatively, you can start it directly on virtualbox
docker-machine env default: it shows the commands needed to start the linux shell.
Output looks like this
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.101:2376"
export DOCKER_CERT_PATH="C:\Users\<yourusername>\.docker\machine\machines\default"
export DOCKER_MACHINE_NAME="default"
export COMPOSE_CONVERT_WINDOWS_PATHS="true"
# Run this command to configure your shell:
# eval $("C:\ProgramData\chocolatey\lib\docker-machine\bin\docker-machine.exe" env default)
Then you switch to WSL. You can access the terminal by typing ubuntu in the research bar
In /.bashrc, you paste the output (replace with your own output)
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.101:2376"
export DOCKER_CERT_PATH="/mnt/c/Users/<yourusername>/.docker/machine/machines/default"
export DOCKER_MACHINE_NAME="default"
export COMPOSE_CONVERT_WINDOWS_PATHS="true"
Note that I changed the DOCKER_CERT_PATH so that it works on a linux environment
Finally, in WSL, run source /.bashrc
You can then test your install by running docker run hello-world
Remember to keep your virtual machine running.
The following two articles really helped me with the install:
https://www.sitepoint.com/docker-windows-10-home/
https://www.paraesthesia.com/archive/2018/09/20/docker-on-wsl-with-virtualbox-and-docker-machine/
I just installed docker on a Mac (docker toolbox from here; at least I hope to have it installed correctly), but when following the tutorial and type the following command
docker run hello-world
I get the following error:
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
Did I do something wrong? Do I miss some installation steps? Do I miss something that is 'obvious' to the experts, but not to docker beginners like me?
I don't see anything in the instructions that says anything about a 'docker daemon'...
On the shell it says:
docker is configured to use the default machine with IP aa.bb.cc.d
The version command seems to work:
Docker version 17.07.0-ce, build 8784753
Update:
I tried to start the daemon by using the command
sudo dockerd
but all I got was
sudo: dockerd: command not found
Correction: The command works, but only in the sell that opened magically during the installation. The command does not work in any other shell. But when I have to close the shell/restart the computer - what to do then? How to 'start docker???
Maybe there is a tutorial that is complete and working and explains why I need a docker-deacon, how to start it, how to start a docker image or whatever, including the complete terminology for beginners?
Docker Toolbox runs a virtual linux machine on which the docker-daemon runs. To control the virtual machine, you use the docker-machine command. For example docker-machine start to start the machine after you reboot your computer, or docker-machine stop to shut it down.
There is also the docker-machine env command which will set the environment variables needed for docker to work. Check the bottom line of it's output, it shows you how to run the command correctly to set the environment variables. Should be exec $(docker-machine env) on Mac if I'm correct. You need to set the environment variables in each shell in which you want to use docker commands.
Docker for mac starts a linux virtual machine in the background which contains the actual docker stuff. When you start a normal terminal, the terminal is not connected to the vm to execute the docker commands.
The docker quick start terminal is the one that you need to use. This terminal will execute the commands on the VM that is running in the background.
With docker toolbox, if you don't launch your terminal from the docker menu, you'll need to configure your environment separately:
eval "$(docker-machine env default)"
To create a Docker container in Bluemix we need to install container plug-ins and container extension. After installing container extension Docker should be running but it show error as :
root#oc0608248400 Desktop]# cf ic login
** Retrieving client certificates from IBM Containers
** Storing client certificates in /root/.ice/certs
Successfully retrieved client certificates
** Checking local docker configuration
Not OK
Docker local daemon may not be running. You can still run IBM Containers on the cloud
There are two ways to use the CLI with IBM Containers:
Option 1) This option allows you to use `cf ic` for managing containers on IBM Containers while still using the docker CLI directly to manage your local docker host.
Leverage this Cloud Foundry IBM Containers plugin without affecting the local docker environment:
Example Usage:
cf ic ps
cf ic images
Option 2) Leverage the docker CLI directly. In this shell, override local docker environment to connect to IBM Containers by setting these variables, copy and paste the following:
Notice: only commands with an asterisk(*) are supported within this option
export DOCKER_HOST=tcp://containers-api.ng.bluemix.net:8443
export DOCKER_CERT_PATH=/root/.ice/certs
export DOCKER_TLS_VERIFY=1
Example Usage:
docker ps
docker images
exec: "docker": executable file not found in $PATH
Please suggest what should I go next.
the error is already telling you what to do:
exec: "docker": executable file not found in $PATH
means to find the executable docker.
Thus the following should tell you where it is located and that would needed to be append to the PATH environment variable.
dockerpath=$(dirname `find / -name docker -type f -perm /a+x 2>/dev/null`)
export PATH="$PATH:$dockerpath"
What this will do is search the root of the filesystem for a file, named 'docker', and has the executable bit set while ignoring error messages and returns the absolute path to the file as $dockerpath. Then it exports this temporarily.
The problem seems to be that your docker daemon isn't running.
Try running:
sudo docker restart
If you've just installed docker you may need to reboot your machine first.
Operating System: Mac OS X
I installed boot2docker and started it, some errors are shown:
wangyaos-MBP-2:~ wangyao$ boot2docker start
Waiting for VM and Docker daemon to start...
..........................o
Started.
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
To connect the Docker client to the Docker daemon, please set:
export DOCKER_TLS_VERIFY=1
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=/Users/wangyao/.boot2docker/certs/boot2docker-vm
wangyaos-MBP-2:~ wangyao$ 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
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=/Users/wangyao/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
wangyaos-MBP-2:~ wangyao$ docker run hello-world
Post http:///var/run/docker.sock/v1.19/containers/create: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
What do I need to do to make $ docker run hello-world work?
Instead of running boot2docker shellinit, you need to do the following in your current shell:
eval "$(boot2docker shellinit)"
The boot2docker shellinit command prints the required export statements to standard out. These statements set the required environment variables for connecting to the boot2docker virtual machine.
By wrapping the output of boot2docker shellinit with eval $(), the variables will be exported in the current shell instead of just printed. This should allow you to connect to the boot2docker vm, which is required for running the example.