I just installed Docker with Docker-Toolbox on my Mac using homebrew: After creating and configuring a Container with Rails, Postgres and starting docker-compose up everything looks fine but i can't access the webserver from host. The output of $ docker-compose up dummy1 I, 2016-03-30T14:39 #6 INFO -: listening on addr=0.0.0.0:8000 fd=10 When i type in Google Chrome the url i get This site can’t be reached 0.0.0.0 refused to connect. ERRCONNECTIONREFUSED So i tried $ docker-machine env dummy with the following output: export DOCKERTLSVERIFY='1' export DOCKERHOST='tcp://192.168.99.100:2376' export DOCKERCERTPATH='/Users/choi/.docker/machine/machines/dummy' export DOCKERMACHINENAME='dummy' When i try in Chrome i get a blank file downloaded. Why is it so? I expect the default greeting page of my Rails App. 192.168.99.100 is the IP of your Docker host, in this instance.
When you are running Docker for Mac, you do not need Docker Machine nodes running at all locally (or anywhere else). With Docker for Mac, you have a new, native virtualization system running (HyperKit) which takes the place of the VirtualBox system. To learn more, see Docker for Mac vs. Docker Toolbox. Docker is an open-source project to easily create lightweight, portable, self-sufficient containers from any application. The same container that a developer builds and tests on a laptop can run at scale, in production, on VMs, bare metal, OpenStack clusters, public clouds and more.
You need to expose the port of your container and then you will be able to connect to it from the outside world. I'm not familiar with Docker Compose, but the log you have posted suggests port 8000 is exposed. Try, therefore, (The reason doesn't work is because that's the address and port of the Docker daemon itself, which isn't HTTP-based. As for 0.0.0.0: This is the address which your web server is listening on inside the container and equates to all external connections therein. However, without any ports exposed, there's no way in!). You can find a right address to call your page this way First, find the CONTAINER ID by: $ docker ps You will get the information like this: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 56dd4d582b08 abc01 'python app.py' 10 minutes ago Up 11 minutes 80/tcp, 0.0.0.0:80-4000/tcp flamboyantbell Now you know the port: 4000.
So that the address should be like this: However, you can double check: $ docker port 56dd4d582b08 You will get in this case the following info: 4000/tcp - 0.0.0.0:80 Now you can try to look you project at http://192.168.99.100:4000/.
This is a snippet of the docker-compose.yml: nginx: restart: always image: nginx:1 ports: - '80:80' - '443:443' volumes: -./docker/conf.d:/etc/nginx/conf.d -./docker/certs:/etc/nginx/certs/edge -./frontend/target:/usr/share/nginx/html links: - web The issue seems to be with the volumes. I was using a file for the first one and it errored on the digitalocean box, so changed it to use a directory and the error went away, but it appears none of the files are present on the nginx container. That works without any issues for me.
The only time the above fails is when I have an existing container that's already set with the same forwarding. When that happened, I received: ERROR: for nginx Cannot start service nginx: driver failed programming external connectivity on endpoint docknginx1 (f1b711ceba861d11f3f56db3609275cadbac958ffe49ca675a3e98384c253d3d): Bind for 0.0.0.0:80 failed: port is already allocated After stopping and removing the container in question and running: docker-compose up The above works without any issues and 'Hello' is displayed when I visit the public IP of the Droplet. This is the error I mentioned using a file (which would normally work for the first volume, but not the others anyway).
ERROR: for nginx Cannot start service nginx: oci runtime error: containerlinux.go:247: starting container process caused 'processlinux.go:359: container init caused 'rootfslinux.go:54: mounting '/Users/richm/Documents/code/company/edge/docker/conf.d/nginx.conf ' to rootfs '/var/lib/docker/aufs/mnt/e2388dac4cc044acceeabd99202c7e4dbace1f713a6870ad2615bf62fa6f2004 ' at '/var/lib/docker/aufs/mnt/e2388dac4cc044acceeabd99202c7e4dbace1f713a6870ad2615bf62fa6f2004/etc/nginx/conf.d/default.conf ' caused 'not a directory ' ': Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type. Now if I run the last few commands you provided: docker-machine rm edgee docker-machine create -driver digitalocean -digitalocean-access-token xxxx -digitalocean-region 'ams3' edgee eval $(docker-machine env edgee) docker-compose -f test.yml up.
![After After](/uploads/1/2/5/5/125511601/767211408.png)
![After After](/uploads/1/2/5/5/125511601/526689881.png)
That doesn't work (using my own token, of course) and the connection fails both locally and when trying to connect from the web to the public IP. Checking the logs on the container reports absolutely nothing docker logs edgee And it appears to be running fine, but it just doesn't respond. I checked the firewall on my end and nothing appears to be preventing the connection, it simply doesn't respond, so I'm trying to see if there's something I'm simply overlooking.