I am trying to setting up heroku app locally using docker which is developed using java (Dropwizard framework) and postgresql.
Following this guidelines : https://devcenter.heroku.com/articles/docker
Getting docker-machine ip using (changed port to 2204 in docker-compose.yml file)
$ docker-compose up
$open "http://$(docker-machine ip default):2204"
Issue: Unable to access local server ping api - http://docker-machine-ip:port/ping
Other details:
OS X El Capitan 10.11.1 (15B42)
Docker version 1.9.0, build 76d6bc9
heroku-toolbelt/3.42.25 (x86_64-darwin10.8.0) ruby/1.9.3
heroku-cli/4.27.9-cce0260 (amd64-darwin) go1.5.2
=== Installed Plugins
heroku-apps#1.0.0
heroku-cli-addons#0.1.1
heroku-docker#1.1.2
heroku-fork#4.0.0
heroku-git#2.4.4
heroku-local#4.1.5
heroku-run#2.9.2
heroku-status#1.2.4
Thanks!
Is docker-machine installed and on your PATH?
From what you've written (http://:port/ping) it looks like you aren't getting the IP address, which implies that docker-machine ip default is returning nothing.
Like so:
$ echo "http://$(docker-machine ip default):2204"
-bash: docker-machine: command not found
http://:2204
See https://docs.docker.com/machine/install-machine/ for installation of docker-machine.
Related
I'm struggling with setting up a JMX connection to Tomcat running in a Docker container using Docker for Mac.
I think I understand the basics, and have a setenv.sh in the tomcat/bin directory looking like this:
CATALINA_OPTS="-Dcom.sun.management.jmxremote=true\
-Dcom.sun.management.jmxremote.local.only=false\
-Dcom.sun.management.jmxremote.authenticate=false\
-Dcom.sun.management.jmxremote.ssl=false\
-Djava.rmi.server.hostname=185.83.15.228\
-Dcom.sun.management.jmxremote.port=9999\
-Dcom.sun.management.jmxremote.rmi.port=9999"
I think the problematic part might be the java.rmi.server.hostname property. I've set this to the IP of the host machine, but I've also tried other obvious things. I believe this should be the IP of the machine on which jconsole or jvisualvm will be running, but this is not working for me.
I start the container like this:
docker run -d -v /Users/timbo/tomcat-jmx.sh:/usr/local/tomcat/bin/setenv.sh -p 8080:8080 -p 9999:9999 tomcat:8.0
so port 9999 is exposed.
When I try to connect using jvisualvm connecting to localhost:9999 (which Docker for Mac will route to the container which is actually on 172.17.0.2) I get the error:
Cannot connect to localhost:9999 using service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi
Any hints on what is wrong?
OK, I think I managed to find it eventually. Setting the value of java.rmi.server.hostname to the hostname of the host (e.g. mymac.local, or whatever is returned by hostname) seem to get it working. All other settings were OK.
Docker for Mac works in a bit different way. The port you map actually gets mapped to the Linux VM it is running in the background. This VM usually has in IP 192.168.99.100. So you should try and connect to 192.168.99.100:9999
To verify what is the IP of your VM, open the Docker CLI terminal and execute below
echo $DOCKER_HOST
tcp://192.168.99.100:2376
This question may be similar to other questions already answered, but I could not find any that is specific to OSX.
I'm new to Docker. I'm using Docker Version 1.12.1-beta25 (build: 11807) native support for OSX. I wanted to install a Docker Bamboo remote agent, following the instructions at https://confluence.atlassian.com/bamboo/getting-started-with-docker-and-bamboo-687213473.html. My Bamboo server is running on the host.
When running the Docker container with docker run -e HOME=/root/ -e BAMBOO_SERVER=http://hostname:port/bamboo -i -t atlassian/bamboo-java-agent:latest, it failed with Connecting to http://hostname:port/bamboo refused
The problem seems to be that the container could not access the host's http://hostname:port/bamboo. What do I need to do to get this working?
You may try to use http://172.17.0.1:port to find the host from the container. You find this address with docker inspect 'name'.
Or, you can use -p hostPort:containerPort in the docker run command and yse http://localhost:containerPort as Banboo_server
I'm facing the following issue with my Docker containers: When I try to enter the container using
docker exec -it container-id /bin/bash
Docker (I assume it's Docker) complains with the following message:
proxy: unknown scheme: http
I have traced this back to the following environment variable that's set on my host machine, since I'm using a proxy server to access the web:
ALL_PROXY=http://myproxy:8080
The error message seems to come from the net/proxy.go file, which can be found here - the error message is issued on the last line of the file. Why would http not be a registered URL scheme in the Docker case?
As soon as I unset ALL_PROXY on the host, I can enter the container without any issues.
Environment:
Mac OS X v10.11.5
Docker v1.11.1
Docker-Machine v0.7.0
Any idea how to fix this (other than unsetting the variable each time)?
I am facing the same issue with docker 1.11.2. I believe the error is coming from method FromURL.
After checking the relevant commit https://github.com/docker/docker/commit/16effc66c028a7800096ed92174ca4bceba229ad, it turns out from v1.11.0-rc1 up to v1.12.0-rc4 are including this commit.
So the solution for me is to install a lower version (I used v1.10.3) of docker toolbox, after which "docker run hello-world" works.
Context
I am trying to use docker-py to connect to docker-machine on OSX.
I can't simply use the standard Client(base_url='unix://var/run/docker.sock') since docker is running on a docker-machine Virtual Machine, not my local OS.
Instead, I am trying to connect securely to the VM using docker.tls:
from docker import Client
import docker.tls as tls
from os import path
CERTS = path.join(path.expanduser('~'), '.docker', 'machine', 'certs')
tls_config = tls.TLSConfig(
client_cert=(path.join(CERTS, 'cert.pem'), path.join(CERTS,'key.pem')),
ca_cert=path.join(CERTS, 'ca.pem'),
verify=True
#verify=False
)
client = docker.Client(base_url='https://192.168.99.100:2376', tls=tls_config)
Problem
When I try to run this code (running something like print client.containers() on the next line), I get this error:
requests.exceptions.SSLError: hostname '192.168.99.100' doesn't match 'localhost'
I've been trying to follow the github issue on a similar problem with boot2docker, ie. the old version of docker-machine, but I don't know much about how SSL certificates are implemented. I tried adding 192.168.99.100 localhost to the end of my /etc/hosts file as suggested in the github issue, but that did not fix the issue (even after export DOCKER_HOST=tcp://localhost:2376).
Maybe connecting via the certificates is not the way to go for docker-machine, so any answers with alternative methods of connecting to a particular docker-machine via docker-py are acceptable too.
UPDATE
Seems like v0.5.2 of docker-machine tries to solve this via the --tls-san flag for the create command. Need to verify but installation via brew is still giving v0.5.1, so I'll have to install manually.
Looks like with the Docker-py v1.8.0 you can connect to Docker-machine like below;
import docker
client = docker.from_env(assert_hostname=False)
print client.version()
See the doc here
I installed docker-machine v0.5.2 as detailed in the release on github. Then I just had to create a new machine as follows:
$ docker-machine create -d virtualbox --tls-san <hostname> <machine-name>
Then I added <hostname> <machine-ip> to /etc/hosts. The code worked after that
from docker import Client
import docker.tls as tls
from os import path
CERTS = path.join(path.expanduser('~'), '.docker', 'machine', 'machines', <machine-name>)
tls_config = tls.TLSConfig(
client_cert=(path.join(CERTS, 'cert.pem'), path.join(CERTS,'key.pem')),
ca_cert=path.join(CERTS, 'ca.pem'),
verify=True
)
client = docker.Client(base_url='https://<machine-ip>:2376', tls=tls_config)
where I replaced <machine-name> in the CERTS path and replaced <machine-ip> in the base_url.
When I began to start docker it stuck and there are so many bad problem with it
System: Windows 8.1 64-bit
I replace virtualbox 5.0.6 to virtualbox 5.0.7 Still, there's an error
Error One:
When Docker Quickstart Terminal want to begin Starting VM... is hanging
Error two
I test my installation with docker run hello-world I get the following:
Post http://127.0.0.1:2375/v1.20/containers/create: dial tcp 127.0.0.1:2375: ConnectEx tcp: No connection could be made because the target machine actively refused it..
* Are you trying to connect to a TLS-enabled daemon without TLS?
* Is your docker daemon up and running?
Error three
Kinematic doesn't work
It work until 99% BUT suddenly it doesn't work
Machine IP could not be fetched. Please retry the setup. If this fails please file a ticket on our GitHub repo.
Best solution I've found after googling for a while:
First check if your Virtualbox version is the latest or at least above 5, then
Run on CMD docker-machine rm -f ##dockerContainerName## (Generally: default)
Delete .docker folder from your user folder
Run docker-machine create --driver virtualbox ##dockerContainerName##
Profit!!!