Docker complains about invalid certificate after update to v1.7.0 - docker

After updating to Docker v1.7.0 (and also boot2docker), I'm getting the following error when running docker ps:
x509: certificate is valid for 127.0.0.1, 10.0.2.15, not 192.168.59.103
Is this a known issue with this version, and what can I do to fix this?

This is a known issue introduced in version 1.7.0 of boot2docker: https://github.com/boot2docker/boot2docker/issues/824
Update to boot2docker 1.7.1
Updating to boot2docker 1.7.1 fixes this issue, as described here.
Options for boot2docker 1.7.0
It seems to be related to the way the network interfaces are coming up during boot. The following options can be used to fix this.
Option 1
The fix is to run the following sequence, which adds code to wait for all network interfaces to be present:
boot2docker ssh
sudo curl -o /var/lib/boot2docker/profile https://gist.githubusercontent.com/garthk/d5a17007c277aa5c76de/raw/3d09c77aae38b4f2809d504784965f5a16f2de4c/profile
sudo halt
boot2docker up
Source (and more details on the code that is downloaded): https://gist.github.com/garthk/d5a17007c277aa5c76de
This has fixed the issue for me, although I had to stop the boot2docker-vm through the VirtualBox UI to get a clean start.
The Gist adds the following to the .profile file in the boot2docker VM:
wait4eth1() {
CNT=0
until ip a show eth1 | grep -q UP
do
[ $((CNT++)) -gt 60 ] && break || sleep 1
done
sleep 1
}
wait4eth1
This function waits up to 1 minute for the eth1 interface to come up.
Option 2
Another option seems to be to do
boot2docker delete
boot2docker init
boot2docker up
This will destroy the boot2docker VM - you might lose any customizations you have done.

Simply running this command fixes the issue for me. This was suggested by a Docker employee via GitHub.
boot2docker ssh sudo /etc/init.d/docker restart
Unfortunately it needs to be run each time you start boot2docker.

I've found the following "easy" alternative to work. Use a shell alias:
alias docker="docker --tlsverify=false"
Thanks to Mark Duncan.

From the troubleshooting guide:
docker-machine regenerate-certs default
docker-machine restart default
And then you're good to go, just run this as usual
eval $(docker-machine env default)

Related

Docker commands fails (in Windows) [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 months ago.
Improve this question
I am trying to use Docker on a windows machine and is hit with every possible issue it seems. My latest one is this:
My machine is running but I can't seem to interact with it using the docker commands. If I run a very standard command like:
docker ps
I get an error message like this:
An error occurred trying to connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v
1.23/containers/json: open //./pipe/docker_engine: The system cannot find the file specified.
So apparently some path is all messed up. Do anyone know which path this is and how to fix this?
Edit (2021) - This answer is for the old Docker Toolbox, not Docker Desktop.
When running docker ps and receiving:
An error occurred trying to connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json: open //./pipe/docker_engine: The system cannot find the file specified.
The following environment properties need to be set:
set DOCKER_CERT_PATH=%USERPROFILE%\.docker\machine\machines\default
set DOCKER_HOST=tcp://192.168.99.100:2376
set DOCKER_MACHINE_NAME=default
set DOCKER_TLS_VERIFY=1
This is assuming the %USERPROFILE%\.docker\machine\machines\default is default path where the cert.pem, key.pem, ca-key.pem, and ca.pem docker files are; the virtual machine name's (created by docker-machine create) is default and Virtual Box DHCP Server's lower bound (found under VirtualBox->File->Preferences->Network->Host-only Networks->hover mouse on VirtualBox Host-Only Ethernet Adapter) is 192.168.99.100 and no other VM is running in VirtualBox.
Same issue here on Win 7. Solution:
In the Docker Quickstart window, at the $ prompt run the below line:
your_user#your_machine MINGW64 ~
$ eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env default)
Then, you'll be able to run "docker run hello-world".
I run into this problem when using docker-machine and I haven't run the docker-machine env command after rebooting. I'm not sure how to do this in cmd.exe, but if you're using powershell try issuing this command:
docker-machine env --shell=powershell | Invoke-Expression
Make sure Hyper-V is up and running:
open elevated command prompt
type bcdedit /set hypervisorlaunchtype auto
reboot
run "Docker for Windows"
I had to deal with the same issue on Windows.
To solve it:
Create a docker machine (only if you have not got one)
docker-machine create default
Get the ENV vars which the docker client needs in order to connect to the docker machine (server) [This you will need to do every time or set in your ENV vars]
docker-machine.exe env default
You can either install them manually or run one of the following depending on your shell environment (cmd, bash, power-shell)
docker-machine env --shell=cmd # you need to run it manually
docker-machine env --shell=bash > env-var-commands-tmp && . env-var-commands-tmp && rm env-var-commands-tmp
docker-machine env --shell=powershell | Invoke-Expression
Open cmd with admin rights.
Execute following command
docker-machine env --shell cmd default
you will receive following output
SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://192.168.99.102:2376
SET DOCKER_CERT_PATH=C:\Users\DBashyal.docker\machine\machines\default
SET DOCKER_MACHINE_NAME=default
REM Run this command to configure your shell:
REM #FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd default') DO #%i
Copy the highlighted line and execute on cmd
#FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd default') DO #%i
Execute following command
docker ps
I created a new machine using the below command
docker-machine create --driver=virtualbox vbox-test
Then executed the command
docker-machine env --shell=powershell | Invoke-Expression
Got it Working...
I had a look at all the above answers and none of them worked.
Then I found out that the command has to be run on a linux command line like bash.
so try:
Type the command into the Docker bash terminal VM that comes with the docker toolbox as opposed to the windows cmd
If you have already made sure that your docker has been started
As pointed in other answers you need to set a few environment variables.
The easiest way to do it is:
#FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd') DO #%i
This will run docker-machine env --shell cmd and add those environmental variables.
If you want these variables to be persistent defined them in windows (tutorial).
Right click the Docker icon in the tray a select "Switch to Windows containers...".
You may be prompted to enable the Containers feature. Do so and reboot, again.
To start default host in windows I know three ways given below you can use one of them.
Starting or restarting already created a default machine by the Docker:
docker-machine start default
docker-machine restart default
Now check docker-machine env
The following environment properties need to be set:
set DOCKER_CERT_PATH=%USERPROFILE%\.docker\machine\machines\default
set DOCKER_HOST=tcp://192.168.99.100:2376
set DOCKER_MACHINE_NAME=default
set DOCKER_TLS_VERIFY=1
To create a new machine using the following command:
Windows 10/HyperV:
docker-machine create --driver hyperv default
docker-machine create -d hyperv default
Mac, Linux, windows 7 & 8:
docker-machine create --driver virtualbox default
docker-machine create -d virtualbox default
I had similar issue when I installed Docker CE for Windows Version 17.11.0-ce-rc4-win39 (14244) Channel: edge e557194 on Windows 10.
In Command/cmd windows, when I tried to run commands docker ps, docker version, docker info, the I got error like “error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.34/version” every time.
To resolved this issue,
I made “Hyper-V” off (Unchecked) from “Turn Windows feature on or off”, which required the OS to be restarted.
And after first restart, I made “Hyper-V” On (Checked), which again required the OS to be restarted.
After second restart, above docker commands started working and giving proper output.
So, turning Hyper-V off and then on resolved this issue for me.
I got the solution from this issue. It not just like Nikesh's answer said SwitchDaemon could fix it directly. I think you should run this command twice to switch your daemon to your previous daemon.
cd "C:\Program Files\Docker\Docker"
./DockerCli.exe -SwitchDaemon
# then check the docker OS/Arch
docker version
# You may see the different OS/Arch
./DockerCli.exe -SwitchDaemon
# then you got your images and containers back
This command is just switch your daemon from your defualt daemon to another daemon(depends on what you set). When you switch to another daemon, the images and containers on the former daemon will disappear(but not deleted).
I have had this issue on a Windows 2016 machine. Happened because the docker service wasn't started. In my case the docker service as failing with the following error
fatal: Error starting daemon: pid file found, ensure docker is not running or delete C:\ProgramData\docker.pid
Deleting the C:\ProgramData\docker.pid file did the trick.
below resolved. i copied answer from another forum
I had this problem after update. After re-installing VB I switched on "VirtualBox NDIS6 Bridged Networking Driver" in properties network connection.
It property switched off default in my case.
Windows 10 Professional
For me the Docker service was running but Docker still needed to be 'started'. That is, I had the setting 'Start Docker when you log in' unchecked in the Docker tray icon.
Prior to finding this out I had gone to the program folder Docker and clicked 'Docker for Windows'. After a short time the message 'Docker is running' was displayed.
For me, this error was resolved after I removed daemon.json file in "%programdata%\docker\config"
The content in my daemon.json is the following:
{
"hosts": ["tcp://0.0.0.0:2375"]
}
I created this manually as part of some testing. But after I restarted the server, I started to get the error in this question.
The error is really troubling. I hope Docker Developers do something about. It took a lot of try and error to get around. Thanks to Stackoverflow and other blogs. In my case, I am using Windows 10 Pro. I settled with DockerToolbox.exe after several failed attempts with Docker for Windows Installer.exe. Then I encountered An error occurred trying to connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v . The followed these steps and the problem got solved.
First, I went to Control Panel -> Turn Windows Features On or Off and unchecked Hyper-V
Next, Open PowerShell as Admin:
docker-machine env --shell=powershell | Invoke-Expression
type bcdedit /set hypervisorlaunchtype auto
Restarted my System. Then I launched "Docker Quickstart Terminal", then I entered this on the shell window.
run "Docker for Windows"
docker run hello-world
I it went well. Then I open Command Prompt
docker run hello-world
It gave the error: Then I entered
set DOCKER_CERT_PATH=%USERPROFILE%\.docker\machine\machines\default
set DOCKER_HOST=tcp://192.168.99.100:2376
set DOCKER_MACHINE_NAME=default
set DOCKER_TLS_VERIFY=1
Most of the suggestions above too are helpful.
I saw this error message after a weekend. My setup was fine before that. My config and connections looked correct. $docker-machine restart default fixed it for me on Windows 7
I was getting this error, while running the command docker-compose up. The problem for me was, the docker service was not running. So I had to run services.msc and start the docker service.
I solved this error by run the {DOCKER_TOOLBOX_INSTALL_PATH}start.sh in bash.
In my case, all above solutions did not resolve. Instead zilurrane response helped.
cd "C:\Program Files\Docker\Docker"
./DockerCli.exe -SwitchDaemon
Switch to Windows Containers
docker info
docker ps
Switch back to Linux containers
docker info
Viola!
The windows switch likely runs the missing configurations that Linux also needs.
I was having similar issue. For me I hadn't logged in to docker from the status bar. What I did was to login to docker from status bar. Once I logged in I was able to run all the commands properly.
Try logging in using your docker id and password maybe that will resolve your issue.
I had the same issue on my Windows 10. Find below what I did to solve it:
After installing Docker, Just restart your PC, run docker application (It may require enabling Hyper-V), then open command line and type:
docker run hello-world
Everything works fine :)
I had this problem. I searched a lot. I checked many things. But in the end, the solution that solved my problem was the following solution.
System Environment:
Windows 10 Professional
Windows engine in Docker
Docker version 20.10.21
Solution
disabled IP6
And
Restarted the service and application

Error checking TLS connection: Error checking and/or regenerating the certs

After I restarted my windows i cannot connect to docker machine running in Oracle Virtual Box.
When i start Docker QuickStart Terminal every thing looks fine, it's coming up OK and it gives me this message:
docker is configured to use the default machine with IP 192.168.99.100
For help getting started, check out the docs at https://docs.docker.com
but when i do:
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default - virtualbox Timeout
and:
λ docker images
An error occurred trying to connect: Get http://localhost:2375/v1.21/images/json: dial tcp 127.0.0.1:2375: ConnectEx tcp: No connection could be made because the target machine actively refused it.
also when i try to reinitialize my env., i get:
λ 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": dial tcp 192.168.99.100:2376: i/o timeout
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.
BTW, Regenerating certs also not helping.
Any idea?
Thanks.
Please try regenerating certificates manually by:
docker-machine --debug regenerate-certs -f default
and check for any errors to fix, then try again:
docker-machine --debug env default
If it's failing on ssh, copy and paste that command into terminal to see what's the problem by adding extra -vv.
If you've got:
debug1: connect to address 127.0.0.1 port 64368: Connection refused
then your machine isn't running (check by docker-machine ls), so try:
docker-machine start
Then try to ssh to it via:
docker-machine -D ssh default
After doing some research I found out that following workaround may solve the issue for now:
Open Network And Sharing Center
Click on Change Adapter Setting
See if you have any enabled adapters such as VPN or VM Ware network adapters.
Try to disable them and try to connect to your container one more time
If it didn't work while you have other adapters disabled, Restart your PC - in my case this worked for me.
What worked for me is this answer from the docker-machine repo:
docker-machine regenerate-certs --client-certs [name]
Basically, what expired is client certificates. The error message I get from docker-machine is similar to yours (i.e., no indication it's the client certs that need to be regenerated).
I fix it doing this:
Removed all host-only interfaces from my VirtualBox (VirtualBox → Preferences → Network → Host-only networks).
rmdir.exe --ignore-fail-on-non-empty ~/.docker/
docker-machine start
docker-machine env
eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env default) (added also at the end of my .bash_profile).
docker run hello-world ← now working
Inspired in this post.
Here is what worked for me. The first steps are similar to what Hazhir proposed, then followed by regenerate the certificates.
Open Network And Sharing Center.
Click on Change Adapter Setting.
Disable all active VMWare network adapters. Usually has explanation "VirtualBox Host-Only Ethernet Adapter".
Connect to your container by running docker-machine start.
Run docker-machine env. If you're like me then you'd get following 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
Which is good. Now all we need to do is to run
docker-machine regenerate-certs -f default
Then test it again with docker-machine env. If you get:
SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://192.168.99.100:2376
SET DOCKER_CERT_PATH=C:\Users\Jay\.docker\machine\machines\default
SET DOCKER_MACHINE_NAME=default
REM Run this command to configure your shell:
REM FOR /f "tokens=*" %i IN ('docker-machine env') DO %i
Then you're all set. In my case I needed to start my virtual machine by running Docker Quickstart Terminal.
I have this problem too. Execute docker-machine regenerate-certs <vm-name> can not solve problem. I search Google the error info and find the solution below.
execute sudo ifconfig vboxnet0 up in terminal.
show docker machine state: docker-machine ls.
now STATE and URL are ok.
But restart the system this problem persists.
GitHub issues link I found is here.
It seems there is a bug in VirtualBox 5.1.24.
Just start the docker machine and then regenerate certificates
docker-machine start <machine-name>
docker-machine regenerate-certs <machine-name>
It works like a charm for me.
None of the answers here helped me. My problem occurred when I want to activate the shell of my virtual machine with eval $(docker-machine env default).
It was then trying to access the port 2376 which was closed, so I had to enter the shell of the VM through ssh and activate the following UFW rule:
sudo ufw allow 2376
The way I ensure being able to connect to my docker machines is by assigning them a fixed IP (and regenerating the certs only once) (no reboot needed)
After that, docker-machine ls always work.
My current script:
(replace %PRGS%\dm\latest by the path where docker-machine.exe is on your machine)
(make sure PATH include the latest /path/to/git/usr/bin, for commands like ssh to be available)
> more dmvbf.bat
#echo off
setlocal enabledelayedexpansion
set machine=%1
if "%machine%" == "" (
echo dmvbf expects a machine name
exit /b 1
)
set ipx=%2
if "%ipx%" == "" (
echo dmvbf x missing ^(for 192.168.x.y^)
exit /b 2
)
set ipy=%3
if "%ipy%" == "" (
echo dmvbf y missing ^(for 192.168.x.y^)
exit /b 3
)
%PRGS%\dm\latest\docker-machine.exe ssh %machine% "sudo sh -c 'echo \"kill \$(more /var/run/udhcpc.eth1.pid)\" | sudo tee /var/lib/boot2docker/bootsync.sh >/dev/null'"
%PRGS%\dm\latest\docker-machine ssh %machine% "sudo sh -c 'echo \"ifconfig eth1 192.168.%ipx%.%ipy% netmask 255.255.255.0 broadcast 192.168.%ipx%.255 up\" | sudo tee -a /var/lib/boot2docker/bootsync.sh >/dev/null'"
%PRGS%\dm\latest\docker-machine ssh %machine% "sudo chmod 755 /var/lib/boot2docker/bootsync.sh"
%PRGS%\dm\latest\docker-machine ssh %machine% "sudo cat /var/run/udhcpc.eth1.pid | xargs sudo kill"
%PRGS%\dm\latest\docker-machine ssh %machine% "sudo ifconfig eth1 192.168.%ipx%.%ipy% netmask 255.255.255.0 broadcast 192.168.%ipx%.255 up"
For instance:
dmvbf default 99 100
docker-machine regenerate-certs -f default
That will assign 192.168.99.100 to the docker machine 'default', and regenerate the certs once.
Then each time docker-machine ls is called, it will display the same IP for 'default'.
Try this way/workaround:
firstly make sure there are ca.pem, cert.pem, key.pem, ca-key.pem under $yourhome/.docker/machine/certs/ folder , for these lost four *.pem files, you can copy them from other places or maybe create them yourselves ( these four pem files are surely not correct at the beginning )
make sure the env set correctly in bash_profile, like:
export DOCKER_HOST=tcp://192.168.99.100:2376
export DOCKER_MACHINE_NAME=default
export DOCKER_TLS_VERIFY=1
export DOCKER_CERT_PATH=/Users/johnwang/.docker/machine/machines/default
rerun the cmd: docker-machine regenerate-certs default (maybe before run this, you need reopen the docker terminal)
Tried on docker toolbox on mac, and it works.
Finally some logs of the result:
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 signed by unknown authority
You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
Be advised that this will trigger a Docker daemon restart which might stop running containers.
...
...
johns-MacBook-Pro:certs johnwang$ docker-machine regenerate-certs default
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...
johns-MacBook-Pro:certs johnwang$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default - virtualbox Running tcp://192.168.99.100:2376 v17.03.1-ce
Hope it helps
also see my response here:https://github.com/docker/machine/issues/2808
In my case it was my FortiClient that caused the issue. After disabling it docker-machine env default worked fine again. I suggest you to check if there's any anti-virus program running in your system.
for me, running
docker-machine --debug regenerate-certs -f name_of_your_vm
worked just fine.
docker-machine version 0.16.1
virtualBox 6.0
also docker was configured to use the default machine with IP 192.168.99.100
I had the same error. I fixed it by open tcp port 2376 in network firewall.
The solution for my problem is taken from here:
https://github.com/docker/machine/issues/3845#issuecomment-271935924
Quote:
If you install docker-machine first time then you do not have in that
host a self-signed CA that will be used to generate your client
certificate and as many server certificates as machines you generate
later on. That CA is generated when you try to create a machine if
that CA is not yet created. So if you try to generate several servers
in parallel (by means of an script), then you’ll generate as many
self-signed (root) CA as docker createcommands, all of them being
written in the same location that seems to be messing up the
environment e.g. spreading out different ca.pem to the remote machines
that do match the final version, causing the cert.pem (host identity)
to be signed by a former ca.pem which no longer exist… or whatever
other abnormal situation.
To fix it, first of all you'll need to delete your existing
self-signed CA. This can be done by removing the folder
~/.docker/machine/certs (NOTE: Note this will force the creation of a
new self-signed CA for docker-machine to use and will yield your
existing machines to fail connecting to the daemon). This will make
your docker-machine to generate valid certificates again. Then, for my
use case I am creating the first machine in foreground and all the
rest of them are done in parallel. That will cause the creation of one
root self-signed CA in isolation and then will be used for further
docker-machine create commands. It worked like a charm!
The reason why I was able to ssh to the host is because there are a
different pair of keys for sshing generate per host that was not
bitten by this.
To sum up, this is what I ended up doing:
Find out what is the command that docker-machine is running. I was using it with gitlab-runner, So I had to run gitlab-runner in debug mode to see what command was it running on docker-machine.
then stop gitlab-runner: gitlab-runner stop
then delete the certificate: rm -rf ~/.docker/machine/certs
then run a single command (from step #1) to re-create the certs (remember - the reason this didn't work is because it was trying to create it multiple times)
then rerun gitlab-runner: gitlab-runner start
Worked for me!
For reader using brew in 2021, after your somehow upgrade virtualbox cask
System Preferences... > Security & Privacy > (Unlock with finger) Allow.
<<Your Computer Should Restart>>.
docker-machine restart default. Done
Solved this issue in MacOS by installing Docker Desktop
brew uninstall docker
brew uninstall docker-machine
Then download Docker Desktop for mac https://docs.docker.com/desktop/mac/install/

Unable to create docker virtual machine

I was using boot2docker previously and everything was working fine. Now when I upgraded to using Docker Toolbox, I am unable to create a new virtual machine.
I am even unable to import the virtual machine that was used with boot2docker.
I get this error when trying to create a new machine:
C:\Program Files\Docker Toolbox\kitematic\resources\resources\docker-machine.exe -D create -d virtualbox --virtualbox-memory 2048 default returned non zero exit code. Stderr: Converting from raw image file="stdin" to file="C:\Users\disk.vmdk"... Creating dynamic image with size 20971520000 bytes (20000MB)... Error creating machine: exit status 1 You will want to check the provider to make sure the machine and associated resources were properly removed.
And I get this when trying to import the old vm that boot2docker used:'
C:\Users\pmandayam>docker-machine create -d virtualbox --virtualbox-import-boot2
docker-vm boot2docker-vm docker-vm
Creating VirtualBox VM...
Error creating machine: exit status 1
You will want to check the provider to make sure the machine and associated reso
urces were properly removed.
Assistance, is greatly appreciated.
Thank you,
Prithvi
I fixed this by reinstalling the Docker Toolbox, make sure you install all the components of the Oracle VM VirtualBox.
I think you have not installed kernel driver.
You can run this:
yum -y install kmod-VirtualBox-$(uname -r) kmod-VirtualBox
or
yum -y install akmod-VirtualBox kernel-devel-$(uname -r) akmods
systemctl restart systemd-modules-load.service
and you should make sure that your firewall have been stopped.
Installing the latest test build of Virtual Box solved the problem for me!
https://www.virtualbox.org/wiki/Testbuilds
The correct answer is actually
docker-machine rm DOCKERHOST
where DOCKERHOST is the machine name (e.g. boot2docker-vm in the original post above).

Network timed out while trying to connect to https://index.docker.io

I installed Docker-Toolbox just now while following their webpage
I started with Docker QuickStart Terminal and see following
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/
docker is configured to use the default machine with IP 192.168.99.100
For help getting started, check out the docs at https://docs.docker.com
bash-3.2$
But when I try to perform docker pull hello-world, this is what I see
bash-3.2$ docker run hello-world
Unable to find image 'hello-world:latest' locally
Pulling repository docker.io/library/hello-world
Network timed out while trying to connect to https://index.docker.io/v1/repositories/library/hello-world/images. You may want to check your internet connection or if you are behind a proxy.
bash-3.2$
What's wrong?
I had the same problem this morning and the following fixed it for me:
$ docker-machine restart default # Restart the environment
$ eval $(docker-machine env default) # Refresh your environment settings
It appears that this is due to the Docker virtual machine getting itself into a strange state. There is an open github issue here
I installed Docker without the Toolbox on Windows 10, so the version that requires Hyper-V to be enabled.
For Docker version 1.12 I had to go into the taskbar, right click the Docker Icon, select Settings -> Network and set the DNS Server to fixed, so that is uses Google's DNS server at 8.8.8.8.
Once that setting was changed, it finally worked.
The simpler solution is to add the following entry in /etc/default/docker file
export http_proxy="http://HOST:PORT/"
and restart the docker service
service docker restart
Update August 2016
Using Docker for Mac (version 1.12.0), was seeing issues of the form:
➜ docker pull node
Using default tag: latest
Pulling repository docker.io/library/node
Network timed out while trying to connect to https://index.docker.io/v1/repositories/library/node/images. You may want to check your internet connection or if you are behind a proxy.`enter code here`
This was resolved by updating my MacBook Pro wireless network settings to include the following DNS entry: 8.8.8.8
For further info, please see this (dated) issue which provided the answer given here.
I ran into this problem running Docker on my MAC(host) with Docker VM in VBOX 5.10. It is a networking issue. The simple fix is to add a bridged network to the VBOX image. You can use the included NAT config present with the VM, but you need to change the ssh port from 50375 to 2375.
sudo service docker stop
sudo service docker start
works for me..
somehow, sudo service docker restart didn't work
(RHEL7)
On Windows 7 and if you believe you are behind proxy
Logon to default machine
$ docker-machine ssh default
Update profile to update proxy settings
docker#default:~$ sudo vi /var/lib/boot2docker/profile
Append from the below as appropriate
# replace with your office's proxy environment
export"HTTP_PROXY=http://PROXY:PORT"
export"HTTPS_PROXY=http://PROXY:PORT"
# you can add more no_proxy with your environment.
export"NO_PROXY=192.168.99.*,*.local,169.254/16,*.example.com,192.168.59.*"
Exit
docker#default:~$ exit
Restart docker machine
docker-machine restart default
Update environment settings
eval $(docker-machine env default)
Above steps are slightly tweaked but as given in troubleshooting guide: https://docs.docker.com/toolbox/faqs/troubleshoot/#/update-varlibboot2dockerprofile-on-the-docker-machine
I ran into this exact same problem yesterday and none of the "popular" answers (like fixing DNS to 8.8.8.8) worked for me. I eventually happened across this link, and that did the trick ... https://github.com/docker/for-win/issues/16
Between Docker for Windows, Windows 10 and Hyper-V, there seems to be a problem during the virtual network adapter creation process. Specifically, you might end up with two "vEthernet (DockerNAT)" network adapters. Check this with Get-NetAdapter "vEthernet (DockerNAT)" (in an elevated PowerShell console). If the result shows more than one adapter, you can disable and rename it with:
$vmNetAdapter = Get-VMNetworkAdapter -ManagementOS -SwitchName DockerNAT
Get-NetAdapter "vEthernet (DockerNAT)" | ? { $_.DeviceID -ne $vmNetAdapter.DeviceID } | Disable-NetAdapter -Confirm:$False -PassThru | Rename-NetAdapter -NewName "OLD"
Then open up Device Manager and delete the disabled adapter (for some reason you can do this from here, but not from the Network and Sharing Center adapters view).
I assume that you have a network problem. Are you behind a proxy? Is it possible that it filters the connection to docker.io or blocks the docker user agent?
I installed the toolbox and ran your test. It works fine, here:
docker is configured to use the default machine with IP 192.168.99.101
For help getting started, check out the docs at https://docs.docker.com
bash-3.2$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
535020c3e8ad: Pull complete
af340544ed62: Already exists
library/hello-world:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.
Digest: sha256:d5fbd996e6562438f7ea5389d7da867fe58e04d581810e230df4cc073271ea52
Status: Downloaded newer image for hello-world:latest
Hello from Docker.
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker Hub account:
https://hub.docker.com
For more examples and ideas, visit:
https://docs.docker.com/userguide/
bash-3.2$
On Windows 10. Just right-click on the systray docker icon-> Settings... -> Rest -> Restrart Docker
I had this same problem with boot2docker and fixed it by restarting it with:
boot2docker restart
I just ran into this today with 1.10.1 and none of the existing solutions worked. I tried to restart, upgrade, regenerate certs, ...
I noticed that I had a lot of networks created on the machine. After removing them with:
docker network ls | grep bridge | awk '{print $1}' | xargs -n1 docker network rm
The DNS started working again.
Note: You may ignore errors about pre-defined networks
If you are behind proxy it is not enough to set HTTP_PROXY and HTTPS_PROXY env. You should set it while machine creation.
Paramer for this is --engine-env:
docker-machine create -d "virtualbox" --engine-env HTTP_PROXY=http://<PROXY>:<PORT> --engine-env HTTPS_PROXY=<PROXY>:<PORT> dev
In my case, installing docker on Alpine Linux I get the error:
Network timed out while trying to connect to https://index.docker.io/v1/repositories/library/........
Using the script here:
https://github.com/docker/docker/blob/master/contrib/download-frozen-image-v2.sh
Works. It downloads the image using curl and then shows you how to untar and 'docker load' it.
I tried the above methods of static DNS at 8.8.8.8 and disabling ipv6 (I didn't understand the proxy thing) and none of them worked for me.
EDIT 9/8/2016:
I was initially using dropbear instead of openssh. Reinstalled Alpine with openssh fixed the problem.
The next problem was 'ApplyLayer exit status 1 stdout: stderr: chmod /bin/mount: permission denied' error during pull.
From (nixaid.com/grsec-in-docker/):
To build the Docker image, I had to disable the following grsec
protections. Modify the /etc/sysctl.d/grsec.conf as follows:
kernel.grsecurity.chroot_deny_chmod = 0
kernel.grsecurity.chroot_deny_mknod = 0
kernel.grsecurity.chroot_caps = 0 # related to a systemd package/CAP_SETFCAP
in alpine's case though it's
/etc/sysctl.d/00-alpine.conf
reboot
Restarting Docker or recreating the image did not help. I rebooted Windows to no avail.
Astoundingly, when I ssh'ed into the running container and did curl https://index.docker.io/v1/repositories/library/hello-world/images I got a perfectly valid response.
I used the Docker Toolbox with VirtualBox on 64bit Windows 10 Pro.
The solution in my case was to uninstall the old Docker version and install the new one that uses Hyper-V instead of VirtualBox.
Now Docker works again.
If you are behind proxy kindly use below commands
sudo mkdir /etc/systemd/system/docker.service.d
sudo cd /etc/systemd/system/docker.service.d
sudo vi http-proxy.conf
[Service]
Environment=HTTP_PROXY=http://proxy-server-ip:port" "NO_PROXY=localhost,127.0.0.1"
sudo systemctl daemon-reload
sudo systemctl show --property=Environment docker
sudo systemctl restart docker
Try this if you can fetch latest ubuntu
sudo docker run -it ubuntu bash
Unable to find image ubuntu:latest locally
latest: Pulling from library/ubuntu b3e1c725a85f: Pull complete
4daad8bdde31: Pull complete
63fe8c0068a8: Pull complete
4a70713c436f: Pull complete
bd842a2105a8: Pull complete
Digest:
sha256:7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a
Status: Downloaded newer image for ubuntu:latest
It worked for me finally :)
Another scenario: if your docker network adapter is disabled, it will fail with this error. The adapter is named "vEthernet (DockerNAT)" or similar. Apparently this adapter is involved somehow in the normal docker pull behavior. Enable it back to solve the problem.
Create a systemd drop-in directory for the docker service:
$ sudo mkdir -p /etc/systemd/system/docker.service.d
Create a file called /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable:
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/"
Hope it helps
refer to https://docs.docker.com/network/proxy/
for me, proxy setting without http:// or https:// prefix works.
e.g:
PROXY:PORT
or with / suffix with http:// or https:// prefix
e.:
http://PROXY:PORT/
On Windows this happened when I moved from a work network to a home network.
To solve it, run:
docker-machine stop
docker-machine start
docker-env
"C:\Program Files\Docker Toolbox\docker-machine.exe" env | Invoke-Expression

docker-machine install fails due to 'Couldn't read CA cert' error

I am trying to setup docker-machine locally on my Windows machine and I followed the install instructions at the Docker Machine Page.
Per the instructions, I ran the following commands in my bash terminal
To install Docker client binary
$curl -L https://github.com/docker/machine/releases/download/v0.3.0/docker-machine_windows-amd64.exe > /bin/docker-machine
and to install Docker machine binary
$ curl -L https://github.com/docker/machine/releases/download/v0.3.0/docker-machine_windows-amd64.exe > /bin/docker-machine
when I try to run docker-machine -v I get the following error
FATAL[0000] Couldn't read ca cert 'C:\Users\Me\.boot2docker\certs\boot2doker-vm\ca.pm: open 'C:\Users\Me\.boot2docker\certs\boot2docker-vm'\ca.pem: The filename, directory name, or volume label syntax is incorrect.
I did some searching and came across a few posts, but can't really see any connection to what would be causing my issues...
https://github.com/hypriot/kitematic/pull/1
https://github.com/docker/machine/issues/908
I installed docker machine today on my Windows 7 machine and run the command without any problem.
Did you use boot2docker before on your machine? If you did, it might be related as mine is a clean machine without any pre-existing docker installations.
Its referring to boot2docker environment.
see this:
DOCKER_CERT_PATH="/Users//.docker/machine/machines/dev"
I got the same answer and was able to resolve it by changing the path pattern to be unix-style in the environment variable.
Inside msysgit bash shell:
export DOCKER_CERT_PATH=/C/Users/Me/.boot2docker/certs/boot2docker-vm
This resolved boot2docker.
Note that I also tried using docker-machine before using boot2docker which previously failed with the same error. That was not resolved the same way boot2docker could be resolved. For now only boot2docker is working for me.

Resources