How can i view my dockerized container app that i just set up on Azure?
I seem to be missing something here.
So i’ve set up a free account on Azure. Using their tutorials as a reference, I managed to get the public/private keys set up and i ssh’d into the server. (this was done after creating a container resource on the portal). Once in that server I sucessfully ran this command:
docker run -d -p 80:80 dallascaley/get-started:part1
I can also verify that it is running by using docker ps command. I also know that this works fine on my local system so i feel that i am very close to getting my first containerized docker app up and running but I just can’t seem to figure out what address i need to go to to view the live app.
According to one post on stack overflow it should be the DNS name that is listed on the resource that starts with ‘swarm-master-ip-‘ but that doesn’t work, nor does the IP address listed. I’ve looked at every record in my resources list and tried all of the DNS and IP address (most of which are duplicates) and none of them seem to work.
3 Solutions collect form web for “How can i view my dockerized container app that i just set up on Azure?”
The root cause it that you create your container on the master, we should create container on swarm agent. By default we can’t create container on swarm master.
Once we content to swarm master and run
docker info, the information like this:
root@swarm-master-784816DA-0:~# docker info Containers: 2 Running: 2 Paused: 0 Stopped: 0 Images: 2 Server Version: 17.06.0-ce Storage Driver: overlay Backing Filesystem: extfs Supports d_type: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: cfb82a876ecc11b5ca0977d1733adbe58599088a runc version: 2d41c047c83e09a6d61d464906feb2a2f3c52aa4 init version: 949e6fa Security Options: apparmor Kernel Version: 3.19.0-65-generic Operating System: Ubuntu 14.04.4 LTS OSType: linux Architecture: x86_64 CPUs: 2 Total Memory: 6.805GiB Name: swarm-master-784816DA-0 ID: IKDF:RSRH:CXT2:M6ER:KI4R:DYAR:2CZH:FFQX:MCRT:4NZB:CBS4:LNRK Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): false Registry: https://index.docker.io/v1/ Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false WARNING: No swap limit support
Then we access the docker swarm cluster, set your DOCKER_HOST environment variable to the local port you configured for the tunnel whit this command
export DOCKER_HOST=:2375 and
root@swarm-master-784816DA-0:~# export DOCKER_HOST=:2375 root@swarm-master-784816DA-0:~# docker info Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 0 Role: primary Strategy: spread Filters: health, port, dependency, affinity, constraint Nodes: 1 swarm-agent-784816DA000001: 10.0.0.5:2375 └ Status: Healthy └ Containers: 0 └ Reserved CPUs: 0 / 2 └ Reserved Memory: 0 B / 7.145 GiB └ Labels: executiondriver=<not supported>, kernelversion=3.19.0-65-generic, operatingsystem=Ubuntu 14.04.4 LTS, storagedriver=overlay └ Error: (none) └ UpdatedAt: 2017-07-03T01:57:18Z Plugins: Volume: Network: Log: Swarm: NodeID: Is Manager: false Node Address: Kernel Version: 3.19.0-65-generic Operating System: linux Architecture: amd64 CPUs: 2 Total Memory: 7.145GiB Name: 2076070ddfd8 Docker Root Dir: Debug Mode (client): false Debug Mode (server): false Experimental: false Live Restore Enabled: false WARNING: No kernel memory limit support
Then we run
docker ps to get the information:
root@swarm-master-784816DA-0:~# docker run -d -p 80:80 yeasy/simple-web 0226e9ab3cadf20701f64c02f1f4a42f5fd57fd297722f268db47db1b124ab5c root@swarm-master-784816DA-0:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0226e9ab3cad yeasy/simple-web "/bin/sh -c 'pytho..." 6 seconds ago Up 5 seconds 10.0.0.5:80->80/tcp swarm-agent-784816DA000001/stupefied_snyder
Then we can use the public IP address or DNS of swarm-agent-lb load balancer to access the website.
More information about set environment, please refer to this link.
I don’t know Azure and the Azure Container Service so I’m trying to answer this based on what I can gather from the documentation.
Since you mentioned
swarm-master-ip I’m assuming you launched a Swarm cluster in the container service. The documentation at https://docs.microsoft.com/en-us/azure/container-service/container-service-docker-swarm suggests that there is a Azure Load Balancer automatically set up for the Swarm agent nodes that will route requests to the applications:
You can now access the application that is running in this container through the public DNS name of the Swarm agent load balancer. You can find this information in the Azure portal.
If there isn’t anywhere in the Azure Container Service portal, then somewhere in the Azure service should be the management for the Azure Load Balancer and list the public DNS for it.
The docker container is bound to the host port 80. So from the host, you should be able to hit that running instance,
curl localhost and get a positive response.
If that works, then assuming this azure instance has a public IP (network interface bound to the public) you could get your IP address with
ifconfig and from anywhere in the world you can reach your server from http://126.96.36.199 (whatever your external interface IP address is)