Docker: Access the webapp running in google cloud VM (Ubuntu) - docker

I am running an image and created a container for one of the open project BusyBox.
Below are my container details.
:~$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1ea15ec5dac5 busybox "sh" 16 hours ago Up 16 hours 0.0.0.0:80->8080/tcp tt3
df236d039aa1 busybox "sh" 17 hours ago Up 17 hours 0.0.0.0:32769->8080/tcp bb1
I am trying to access the container using the URL http://GoogleExternalIP:32769 and http://GoogleExternalIP:80 but getting the error like This site can’t be reached 35.231.34.38 refused to connect. Search Google for 231 32769 ERR_CONNECTION_REFUSED
Note: My Jenkins is running on the port 8080 and I can access it. But Jenkins is installed on VM. but the apps which I want to access are running in Docker Containers.
I have set up the Google firewall to allow all incoming for all ports.

Related

elastichead is not connecting with elasticsearch docker container

my elastichead is not connecting even when my elasticsearch container is running.
I can't understand the problem.
(env) C:\Users\shubh\Desktop\react-django\emt_api\emt_assets>docker ps -a
CONTAINER ID IMAGE
COMMAND CREATED STATUS PORTS
NAMES 117ba87ad874 mdillon/postgis:11
"docker-entrypoint.s…" 9 hours ago Up 4 hours
0.0.0.0:5432->5432/tcp postgres 70b6527e1046 docker.elastic.co/elasticsearch/elasticsearch:6.8.8
"/usr/local/bin/dock…" 9 hours ago Up 5 hours
0.0.0.0:9200->9200/tcp, 9300/tcp elasticsearch
but after running elastichead head there is still no connection.
my system is windows 10 home edition.
i was working with the docker toolbox which includes oracle virtual box. There you can see your docker machine settings.
just stop your docker machine with command in docker quickstart terminal
docker-machine stop <docker-machine name>
Then in your oracle virtual box..go to System>Advanced> Increase the memory to 4gb(4096mb)
And start docker-machine with command in docker quickstart terminal
docker-machine start <docker-machine name>
and work with your container.
Its very common for ES process to die due to out of memory error. Please refer my this SO answer for more info.

In SWARM not able to access service from worker node

I am new to the docker world. During learning I have created the below setup:
1.Virtual machine - Ubuntu 20 running on VMware workstation 15 Player. IP - 192.168.0.106. I am able to access the internet from this VM(say it VM1) and able to ping that system from my physical system OS( Windows 10)
2.Virtual Machine - Ubuntu 20 running on VMware workstation 15 Player. IP - 192.168.0.105. I am able to access the internet from this VM(say it VM2) and able to ping that system from my physical system OS( Windows 10)
Now I have created the swarm as follows from VM1:
sudo docker swarm init --advertise-addr 192.168.0.106:2377 --listen-addr 192.168.0.106:2377
Then I added the VM2 in this swarm as follows:
sudo docker swarm join --token SWMTKN-1-4i56y47l6o4aycrmg7un21oegmfmwnllcsxaf4zxd05ggqg0zh-9qp67bejerq9dhl3f0suaauvl 192.168.0.106:2377 --advertise-addr 192.168.0.105:2377 --listen-addr 192.168.0.105:2377
After that I checked the swarm details:
sudo docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
ogka7rdjohri9elcbjjcpdlbp * ubuntumaster Ready Active Leader 19.03.12
7qu9kiprcz7oowfk2ol31k1mx ubuntuslave Ready Active 19.03.13
Then deployed the nginx service as follows from VM1:
sudo docker service create -d --name myweb1 --mode global -p9090:80 nginx:1.19.3
Service status:
sudo docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
e1o9cbm3e0t myweb1 global 2/2 nginx:1.19.3 *:9090->80/tcp
Service details:
sudo docker service ps zf6kfw7aqhag
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
egd8oliwngf3 myweb1.ogka7rdjohri9elcbjjcpdlbp nginx:1.19.3 ubuntumaster Running Running 14 minutes ago
1o4q8dlt94jj myweb1.7qu9kiprcz7oowfk2ol31k1mx nginx:1.19.3 ubuntuslave Running Running 14 minutes ago
Now I am able to access the nginx from VM1 using URL: 192.168.0.106:9090 and localhost:9090. But I am not able to access nginx from VM2 using URL: 192.168.0.105:9090 and localhost:9090. My understanding that the nginx are running on both the VMs and can be accessible on both.
in both the VM1 I am able to see the nginx container is running.
VM1 :
sudo docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7a4e13e49dfd nginx:1.19.3 "/docker-entrypoint.…" 16 minutes ago Up 15 minutes 80/tcp myweb1.ogka7rdjohri9elcbjjcpdlbp.egd8oliwngf35wwpjcieew323
VM2:
sudo docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
999062110f0 nginx:1.19.3 "/docker-entrypoint.…" 16 minutes ago Up 16 minutes 80/tcp myweb1.7qu9kiprcz7oowfk2ol31k1mx.1o4q8dlt94jj4uufysnhsbamd
Please guide me on this if I am doing any mistakes.
TIA,
Deb
Problem solved! it was an issue was the ip clashing. Restarted the whole systems including the VM and router to solve this issue.

How connect to Docker Container through docker-machine ip address?

I am trying to connect to my docker container..
My docker-machine ip is:
docker-machine ip default
192.168.99.100
docker ps
b546f4666f01 richarvey/nginx-php-fpm:php5 "/start.sh" 2 days ago Up 2 days 443/tcp, 0.0.0.0:8080->80/tcp my_container
When I try to access in a browser:
192.168.99.100:8080 doesn't resolve. But I can access the container doing localhost:8080
Here's the docker + machine versions:
Docker version 18.06.0-ce, build 0ffa825
docker-machine version 0.15.0, build b48dc28d
I used to be able to directly access the container w/ the same network linking properties above w/ an older version.

Why docker containers can run, despite of docker-machine is not running?

Apparently, this is a silly question, though, i hope someone can help me.
I was thinking docker containers can run, because docker-machine is running on my MacOS X. Like on this situation:
> docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default - virtualbox Running tcp://192.168.99.100:2376 v1.12.2
> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
abb8beb2a0fd httpd:2.4 "httpd-foreground" 48 minutes ago Up 47 minutes 0.0.0.0:80->80/tcp romantic_kare
But container can run, although in this situation.
> docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default - virtualbox Stopped Unknown
> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
abb8beb2a0fd httpd:2.4 "httpd-foreground" 48 minutes ago Up 47 minutes 0.0.0.0:80->80/tcp romantic_kare
Are there are no relationships between them?
Reference: https://docs.docker.com/machine/overview/
I installed Docker for Mac.
> docker --version
Docker version 1.12.1, build 6f9534c
This post is duplicated with Default docker machine on Mac.
Docker 1.12 and onward no longer uses docker-machine to run containers. Instead it uses a native docker engine for mac/windows.

docker container not available at port 80 like it should

Im using docker registry and the docker frontend is listed as running when I invoke docker ps but it is not available at localhost:80:
e2a54694e434 konradkleine/docker-registry-frontend "/bin/sh -c $START_S 26 seconds ago Up 2 seconds 443/tcp, 0.0.0.0:8080->80/tcp serene_tesla
Do you use boot2docker or docker-machine? If so, you should use the VMs IP address instead of localhost.
for boot2docker usually 192.168.59.103.
for docker-machines IP address type docker-machine ip <yourmachine>.

Resources