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>.
Related
How do I detect the IP of a docker container running on Windows host with WSL?
I can see docker container is running:
juergen#DESKTOP4WIN10:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
74f26c50a729 jschulze71/apache2 "sh -c '. /etc/apach…" 24 seconds ago Up 23 seconds 0.0.0.0:8080->80/tcp elegant_jepsen
You can try launching "hostname -I" command inside the running container.
For example:
docker exec -ti <container_id> /bin/bash -c "hostname -I"
You can get the IP address of containers from this command:
docker inspect -f "{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}" <container_name_or_id>
Open Windows command line and use ipconfig
ipconfig
Find Ethernet-Adapter vEthernet (WSL) (Or similar) there you will see IP4 and IP6.
Screenshot is from a german Windows but I am sure other version look pretty much the same.
I have two Redis containers running on a K8s worker node. One is controlled by a Deployment (redisdeploymet1) and the other is a standalone Docker container that I created locally on worker1 (outside the knowledge of K8s)“:
root#worker1:~# docker ps | head -1 ; docker ps | grep redis | grep -v pause
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bc7b6fd74187 redis "docker-entrypoint.s…" 4 minutes ago Up 4 minutes 6379/tcp nervous_vaughan
3c6fc536e265 redis "docker-entrypoint.s…" 42 minutes ago Up 42 minutes k8s_redis_redisdeploymet1-847d97
Why shouldn’t we see the PORT details on both entries above? I have actually tested them; both are indeed listening on 6379.
My ultimate goal is to identify which ports a specific Pod is listening on. Let's say the Dockerfile is not available.
Thanks
You can use docker port command.
docker port <container_id>: List port mappings or a specific mapping for the container
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.
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.
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.