boot2docker malformed HTTP status code "/v1.15/containers/json" - docker

Tried re-installing boot2docker with brew, but getting the same problem. Below is a screen grab of the commands I ran. Anyone have any idea what can be wrong?
==> Checking out tag v1.3.0
==> go get -d
==> make goinstall
๐Ÿบ /usr/local/Cellar/boot2docker/1.3.0: 2 files, 7.2M, built in 3 seconds
~ ยป boot2docker init wg#wg-MacBook-Pro
------------------------------------------------------------
~ ยป boot2docker up
wg#wg-MacBook-Pro
Waiting for VM and Docker daemon to start...
.....................ooooooooooooooooo
Started.
Writing /Users/wg/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/wg/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/wg/.boot2docker/certs/boot2docker-vm/key.pem
To connect the Docker client to the Docker daemon, please set:
export DOCKER_CERT_PATH=/Users/wg/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
------------------------------------------------------------
~ ยป export DOCKER_CERT_PATH=/Users/wgillmer/.boot2docker/certs/boot2docker-vm
wg#wg-MacBook-Pro
------------------------------------------------------------
~ ยป export DOCKER_TLS_VERIFY=1
wg#wg-MacBook-Pro
------------------------------------------------------------
~ ยป docker ps
wg#wg-MacBook-Pro
Password:
2014/10/22 20:52:08 Get http:///var/run/docker.sock/v1.15/containers/json: malformed HTTP status code "/v1.15/containers/json"
------------------------------------------------------------
~ ยป
Deleting my .boot2docker directory and re-running a init to get a new download and then a up seems to give the same results.
~ ยป boot2docker destroy
wg#wg-MacBook-Pro
------------------------------------------------------------
~ ยป rm -Rfv ./.boot2docker
wg#wg-MacBook-Pro
./.boot2docker/boot2docker.iso
./.boot2docker/certs/boot2docker-vm/ca.pem
./.boot2docker/certs/boot2docker-vm/cert.pem
./.boot2docker/certs/boot2docker-vm/key.pem
./.boot2docker/certs/boot2docker-vm
./.boot2docker/certs
./.boot2docker
------------------------------------------------------------
~ ยป boot2docker init
wg#wg-MacBook-Pro
Latest release for boot2docker/boot2docker is v1.3.0
Downloading boot2docker ISO image...
Success: downloaded
https://github.com/boot2docker/boot2docker/releases/download/v1.3.0/boot2docker.iso
to /Users/wg/.boot2docker/boot2docker.iso
------------------------------------------------------------
~ ยป boot2docker up
wg#wg-MacBook-Pro
Waiting for VM and Docker daemon to start...
.....................ooooooooooooooooo
Started.
Writing /Users/wg/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/wg/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/wg/.boot2docker/certs/boot2docker-vm/key.pem
Your environment variables are already set correctly.
------------------------------------------------------------
~ ยป docker ps
wg#wg-MacBook-Pro
Password:
2014/10/22 21:04:20 Get http:///var/run/docker.sock/v1.15/containers/json: malformed
HTTP status code "/v1.15/containers/json"
------------------------------------------------------------
~ ยป

I learned that if you don't add these to your shell's rc file, it can resuld in docker client spitting out malformed json error messages:
export DOCKER_CERT_PATH=/Users/sindhus/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
I made the mistake of just adding export DOCKER_HOST=tcp://192.168.59.104:2376 and trying to run docker ps etc commands.
Hope this helps!

Why is docker ps asking you for a password?
It looks like docker may be aliased to sudo docker (or you're actually running sudo docker ps), which would mean your docker environment vars aren't set correctly.
See this answer for a full explanation.

Related

ansible over docker hosts does not as expected

I'm facing a bit weird issue targeting in ansible docker containers.
Inventory
el7_02 ansible_port=6000 ansible_user=user ansible_host=localhost
el7_03 ansible_port=6001 ansible_user=user ansible_host=localhost
playbook
- shell: hostname
register: x
- debug: msg="{{ x.stdout}}, {{ansible_hostname}}, {{ansible_user}}, {{ansible_port}}"
output
TASK [Gathering Facts] *************************************************************************************************
ok: [el7_03]
ok: [el7_02]
TASK [x : shell] *************************************************************************************************
changed: [el7_03]
changed: [el7_02]
TASK [x : debug] *************************************************************************************************
ok: [el7_03] => {
"msg": "el7_02, el7_02, user, 6001"
}
ok: [el7_02] => {
"msg": "el7_02, el7_02, user, 6000"
}
as you can see for some reasons I see not expected hostname for the container el7_03. While I'd expect to see in a debug tasks for the docker el7_03 the same hostname (i.e. el7_03 but not el7_02). Why I receive "the wrong" output?
checking hostnames in docker
~/ $ ssh -p 6000 user#localhost 'hostname'
el7_02
~/ $ ssh -p 6001 user#localhost 'hostname'
el7_03
if I will switch to ansible_connection=docker then I get what I expect. however, I cannot use it because when I interact with anything located outside of my laptop (installing anything or downloading from the internet) time to time (and quite often) I receive timeouts. Maybe there is a way how to get rid of timeouts?
os: macos
ansible: 2.9.11
python: 3.8.5
docker: 19.0.3.8
thank you
you need to work around the issue that ansible looks up a host via hostname and not via hostname:port pair .
my workaround for this issue is as follows:
$ grep pi. /etc/hosts
127.0.0.1 pi1
127.0.0.1 pi2
127.0.0.1 pi3
# inventory contents:
$ cat all_rpis.ini
pi1:3321
pi2:3322
pi3:3323

Why am I getting a syntax error with RSelenium in Docker?

I am trying to follow this tutorial RSelenium and scraping as it seems to be just what I am trying to do. Use RSelenium to scrape a Javascript website.
I have installed Docker and all seems good, but I run into problems with the following command:
remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "firefox'")
which I think is intended to be:
remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "firefox")
However, both versions return this error:
bash: syntax error near unexpected token `('
What am I doing wrong?
Here is the full log:
Starting "default"...
(default) Check network to re-create if needed...
(default) Windows might ask for the permission to configure a dhcp server. Sometimes, such confirmation window is minimized in the taskbar.
(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.
Regenerate TLS machine certs? Warning: this is irreversible. (y/n): 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...
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ 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
Start interactive shell
graha#LAPTOP-SWIFT MINGW64 /c/Program Files/Docker Toolbox
$ docker pull selenium/standalone-chrome Using default tag: latest
latest: Pulling from selenium/standalone-chrome
Digest: sha256:d46e05c47bad20ec4ad675368fa1b7addb6c9529e8fdc23f5eb55629235b8e14
Status: Image is up to date for selenium/standalone-chrome:latest
graha#LAPTOP-SWIFT MINGW64 /c/Program Files/Docker Toolbox
$ docker run -d -p 4445:4444 selenium/standalone-chrome fbb8c9145e92789f6941cc04fb74d216d43aed178825c1698ede2644589c715f
graha#LAPTOP-SWIFT MINGW64 /c/Program Files/Docker Toolbox
$ remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "chrome")
bash: syntax error near unexpected token `('
graha#LAPTOP-SWIFT MINGW64 /c/Program Files/Docker Toolbox
$
Thanks.
Your basic problem is that you're trying to type an R command at the bash shell prompt, and that's never going to work. I think you may be missing the point of the tutorial you're following:
The Docker image you're using just provides Selenium, a tool for remotely controlling web browsers. It is expected that you are running R on your host, and pointing the RSelenium library at the selenium service offered by the Docker container.
You will need to install R on your host in order to follow that tutorial.

Docker - Unable to find any JVMs - Error checking TLS connection

I am just doing the docker installation guide. After the install I open "Docker Quickstart Terminal" (Step 3). I am getting this error:
bash --login '/Applications/Docker/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh'
Unable to find any JVMs matching version "1.8.60".
Error checking TLS connection: Something went wrong running an SSH command!
command : ip addr show
err : exit status 255
output :
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/
Error getting IP address: Something went wrong running an SSH command!
command : ip addr show
err : exit status 255
output :
docker is configured to use the default machine with IP
For help getting started, check out the docs at https://docs.docker.com
I checked my java version:
โžœ ~ java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
I am using OSX 10.11.3 and iTerm with Zsh.
What's wrong?
EDIT:
This is the output of running docker-machine ls:
โžœ ~ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default * virtualbox Running Unknown Something went wrong running an SSH command!
command : ip addr show
err : exit status 255
output :
It looks like your virtualbox instance is running but isn't running correctly and it can't connect to docker. you have two options.
Remove the virtualbox instance and create a new one. (only delete if you are sure you don't need anything else)
$ docker-machine rm default
$ docker-machine create --driver virtualbox default
This is more work, but worth it if you need to save stuff on the VM. Try and find out what is wrong with the virtualbox instance and fix it.
Firs try restarting
$ docker-machine restart default
try sshing into the virtualbox
$ docker-machine ssh default
If you can get into the VM, then you can find out if docker is running and if not, try and get it running.

Cannot install docker on OS X Version 10.9.5

I first tried installing VirtualBox by downloading "VirtualBox 5.0 for OS X hosts (amd64)" from the VirtualBox download page, and then installed boot2docker and docker via brew.
The first apparent issue appeared when creating the boot2docker-vm image:
$ boot2docker init
2015/07/27 21:38:13 Creating VM boot2docker-vm...
2015/07/27 21:38:13 Apply interim patch to VM boot2docker-vm (https://www.virtualbox.org/ticket/12748)
2015/07/27 21:38:13 Failed to modify VM "boot2docker-vm": exit status 1
Launching the VirtualBox manager application I can see the boot2docker-vm machine "Running", but looking at the log I see something like this which appears to indicate that the boot2docker-vm "machine" failed to boot:
00:00:04.169546 Guest Log: BIOS: Boot : bseqnr=1, bootseq=4231
00:00:04.169711 Guest Log: BIOS: Boot from Floppy 0 failed
00:00:04.170101 Guest Log: BIOS: Boot : bseqnr=2, bootseq=0423
00:00:04.170490 Guest Log: BIOS: CDROM boot failure code : 0002
00:00:04.170800 Guest Log: BIOS: Boot from CD-ROM failed
00:00:04.171190 Guest Log: BIOS: Boot : bseqnr=3, bootseq=0042
00:00:04.171795 Guest Log: int13_harddisk: function 02, unmapped device for ELDL=80
00:00:04.172304 Guest Log: BIOS: Boot from Hard Disk 0 failed
00:00:04.172706 Guest Log: BIOS: Boot : bseqnr=4, bootseq=0004
00:00:04.172991 Guest Log: BIOS: Booting from LAN...
00:00:04.191271 Display::handleDisplayResize(): uScreenId = 0, pvVRAM=0000000000000000 w=720 h=400 bpp=0 cbLine=0x0, flags=0x1
00:00:06.446949 Guest Log: BIOS: Boot from LAN failed
00:00:06.448852 Guest Log: Could not read from the boot medium! System halted.
I uninstalled everything and then tried downloading and installing from boot2docker download page, which installs VirtualBox, boot2docker, and docker all in one go. But I still see the same problem indicated above (the boot2docker-vm machine fails to boot).
I'm reluctant to make big changes to the OS X version on my laptop, since my hardware is old. But I'll try the installation sequence on a more modern machine and see if it works there.
Has anyone managed to make docker work on OS X Version 10.9.5?
EDIT (adding additional information which comments suggest might be relevant):
My machine has:
2.26GHz Intel Core 2 Duo
4Gb of RAM (1067 MHz DDR3)
NVIDIA GeForce 9400M 256 MB
OS X 10.9.5
I installed everything as the primary User (not root) on my system.
And the versions of everything which I installed are:
VirtualBox 4.3.30 r101610
boot2docker version 1.7.1
docker version 1.7.1
This issue on github might be of help (Latest version of virtual box 4.3.x works fine in the issue described). Though I would suggest to use docker-machine. Below are the steps (Installation):
$ docker-machine create --driver virtualbox dev
$ eval "$(docker-machine env dev)"
And then you can use docker commands as usual.
Some of the comments in the github issue suggested by nash_ag and this stackoverflow question pointed me in the right direction.
This is the sequence of steps I used to get VirtualBox, boot2docker, docker, and docker-machine working in my environment (where $USERNAME is my primary OS X User, who installed VirtualBox), with several wrong turns elided, and most output omitted:
$ rm -rf /Users/$USERNAME/VirtualBox\ VMs/
$ boot2docker delete
(ran VirtualBox Uninstall script from my desktop)
...
$ brew tap caskroom/cask
...
$ brew update
...
$ brew install brew-cask
...
$ brew cask install virtualbox
...
$ VBoxManage -v
5.0.0r101573
$ boot2docker -v
Boot2Docker-cli version: v1.7.1
Git commit: 8fdc6f5
$ VBoxManage list vms
(nothing)
$ boot2docker init -v
...
$ boot2docker up
...
$ eval "$(boot2docker shellinit)"
(writes .pem files)
$ brew install docker-machine
...
$ docker-machine -v
docker-machine version 0.3.1 (HEAD)
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM
$ docker-machine create --driver virtualbox dev
...
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM
dev virtualbox Running tcp://192.168.99.100:2376
$ VBoxManage list vms
"boot2docker-vm" {99d5c5c1-e7cc-49bf-93c7-b0cbf626d62c}
"dev" {341fd11e-86f9-46ca-89e6-39ee78458a4b}
$ eval "$(docker-machine env dev)"
$ docker run -d -p 8000:80 nginx
...
$ curl $(docker-machine ip dev):8000
<!DOCTYPE html>
...
At this point things appear to be working well enough for me to use the "standard" docs/instructions for docker and docker-machine, so my original problem is solved.

error while executing the following commands

When I run the following commands I am getting the below output:
sudo docker run ubuntu /bin/echo hello world
WARNING: WARNING: Local (127.0.0.1) DNS resolver found in resolv.conf and containers can't use it. Using default external servers : [8.8.8.8 8.8.4.4]
And when I run docker version, the output is:
mkdir /var/lib/docker/containers: permission denied[/var/lib/docker|a0f30ece] -job initserver() = ERR (1)
2014/03/03 21:49:51 initserver: mkdir /var/lib/docker/containers: permission denied
What is the problem?
My Problem solved by following :
Try modify the /etc/default/docker file, un-comment the OPTS line:
6 # Use DOCKER_OPTS to modify the daemon startup options.
7 #DOCKER_OPTS="-dns 8.8.8.8"

Resources