I hosted our application inside a docker container. When I run docker ps command, it gave info like below.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6405daf98246 rdarukumalli/testapp-master "/bin/bash" 4 hours ago Up 4 hours 0.0.0.0:32797->443/tcp, 0.0.0.0:32796->8000/tcp, 0.0.0.0:32795->8080/tcp, 0.0.0.0:32794->8443/tcp, 0.0.0.0:32793->9997/tcp insane_poincare
I am trying to access this application from my machine with the following URLs. Nothing worked so far.
0.0.0.0:32795/testapp/login.jsp
0.0.0.0:8080/testapp/login.jsp
localhost:8080/testapp/login.jsp
localhost:32795/testapp/login.jsp
However, if i give the command "curl http://localhost:8080/testapp/login.jsp" inside bash of docker container,
I can login page html is coming.
Can some one help me in understanding these URL mappings and what URL i need to use to access this login page outside docker container?
Try curl http://localhost:32795/testapp/login.jsp.
Your docker ps shows that container's port 8080 is bound to external port 32795 : [...] 0.0.0.0:32795->8080/tcp [...]
docker ps command shows the running container which displays the port your application is running. On browser type http://localhost:54529/your_application_page. if you are running application locally, then this is the port which needs to be changed in browser to access container application.
Related
I am just studying the Docker and found out it seems that we don't need to run docker-tutorial image and the port:80 is always listened on just like below picture:
At first, I thought it is automatically managed by Docker Desktop. But it is not. Because after I close the Docker desktop completely, it is still there.
I even run a command to check the process of port 80 and no process is there:
when no process is on this port, it is still running. It drives me crazy. I do have followed docker start tutorial to run this tutorial web application and at that time I can also open localhost:80.
After that, I have stopped and removed container and even the image as well as closing the Docker app, the page, however, is still there.
Does any have encountered this situation or have any idea? How does Docker do this?
After a day, i start my mac again without running Docker and it is still there in a messy way:
By the looks of the page, it is running off the browser cache. Clear the cache or open an incognito window to use the newly created services on port 80.
Try stopping the container. E.g.
List running containers.
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4b223e7cc8c5 docker/getting-started "/docker-entrypoint.…" About a minute ago Up About a minute 0.0.0.0:80->80/tcp wonderful_goldstine
Stopping the docker/getting-started container with its container ID.
$ docker stop 4b223e7cc8c5
4b223e7cc8c5
At this point, the container will have stopped and port 80 will be free. It will still be on your machine if you ever want to restart it, but you can remove it with:
$ docker rm 4b223e7cc8c5
4b223e7cc8c5
I had the same issue but in my case it' was just a cache in the browser. After stopping the docker image or deleted it, it will work probably
For stop it.
$ docker stop [CONTAINER ID]
for delete it
$ docker rm [CONTAINER ID]
I try to run a Shiny app on a remote server (here DigitalOcean) using Docker.
First, I created a package for my app as a .tar.gz file. Then:
Create the following Dockerfile:
FROM thinkr/rfull
COPY myapp_*.tar.gz /myapp.tar.gz
RUN R -e "install.packages('myapp.tar.gz', repos = NULL, type = 'source')"
COPY Rprofile.site /usr/local/lib/R/etc
EXPOSE 3838
CMD ["R", "-e myapp::run()"]
Create the following Rprofile.site
local({
options(shiny.port = 3838, shiny.host = "0.0.0.0")
})
Then I build the image using
docker build -t myapp .
I push the image to DockerHub using
docker tag myapp myrepo/myapp:latest
docker push myrepo/myapp
I connect to my droplet on DigitalOcean
eval $(docker-machine env mydroplet)
I create a container from my image on Dockerhub
docker run -d -p 3838:3838 myrepo/myapp
So far it seems to work fine. No message error and I got expected messages when I run docker logs mycontainer
The problem is that I do not know how to actually access the running container. When I connect to the droplet IP, I got nothing (This site can’t be reached). If use
docker inspect --format '{{ .NetworkSettings.IPAddress }}' mycontainer
I got an IP, it seems to be a local one ('172.17.0.2').
When I run docker ps here is what I got
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6d4195XXXX myrepo/myapp "R '-e myapp::ru…" 10 days ago Up 10 days 0.0.0.0:3838->3838/tcp, 8787/tcp determined_brown
So the question is: how can I run my dockerized shiny app on my droplet IP address?
Check if you have added the firewall rule to allow connections to 3838 port.
https://www.digitalocean.com/docs/networking/firewalls/resources/troubleshooting/
First, you need to publish the port, which is what you already do.
Second, you need to access the IP address of the host machine where there port is published.
The easiest way is probably to check the output of docker-machine env mydroplet and use this IP, together with your published port.
Hello i have an Ubuntu VM (using bridged adapter) in which i'm running a docker container in which im starting Rundeck with a pre-build war file in a mounted Volume.When i run the war the first time it creates its files and the config file:
#loglevel.default is the default log level for jobs:
ERROR,WARN,INFO,VERBOSE,DEBUG
loglevel.default=INFO
rdeck.base=/home/rundeck/rundeck
#rss.enabled if set to true enables RSS feeds that are public (non-authenticated)
rss.enabled=false
server.address=7d142a279564
grails.serverURL=http://7d142a279564:4440
dataSource.dbCreate = update
dataSource.url = jdbc:h2:file:/home/rundeck/rundeck/server/data/grailsdb;MVCC=true
# Pre Auth mode settings
rundeck.security.authorization.preauthenticated.enabled=false
rundeck.security.authorization.preauthenticated.attributeName=REMOTE_USER_GROUPS
rundeck.security.authorization.preauthenticated.delimiter=,
# Header from which to obtain user name
rundeck.security.authorization.preauthenticated.userNameHeader=X-Forwarded-Uuid
# Header from which to obtain list of roles
rundeck.security.authorization.preauthenticated.userRolesHeader=X-Forwarded-Roles
# Redirect to upstream logout url
rundeck.security.authorization.preauthenticated.redirectLogout=false
rundeck.security.authorization.preauthenticated.redirectUrl=/oauth2/sign_in
rundeck.log4j.config.file=/home/rundeck/rundeck/server/config/log4j.properties
As you see "server.address" and "grails.serverURL" get the default image ID as IP.
I can't access the container using this url,but i can access it using localhost:4440.But after loging in in rundeck it redirects me to "grails.serverURL" which gives "Server Not Found" as stated before.
This is how im starting the container:
sudo docker run -it -v /path/to/source:/path/to/dest -p 4440:4440 <imageID>
When i change the "server.address" and "grails.serverURL" to localhost or 127.0.0.1 i can't access the container at all.
Sorry if the question was answered before I'm new at docker and been at this for several days now,couldn't find a solution,Thanks!
I'm no expert in rundeck, but looking at the documentation rundeck image has two env vars for setting the URL and address RUNDECK_GRAILS_URL and RUNDECK_SERVER_ADDRESS
docker run -d -e RUNDECK_GRAILS_URL=http://127.0.0.1:4440 -e RUNDECK_SERVER_ADDRESS=0.0.0.0 -p 4440:4440 rundeck/rundeck.
Now you can access your application at http://localhost:4440
In case if you're running your docker container in a remote server, then update your RUNDECK_GRAILS_URL as RUNDECK_GRAILS_URL=http://<remote_server_ip>:4440.
Now you can access your app at http://remote_server_ip:4440
enter image description here
I have built a docker image of IBM WAS 9 Base for Windows. My image is named as was9_new. After the image is successfully built, I use docker run command as follows :
docker run --name was_test -h was_test -p 9043:9043 -p 9443:9443 -d was9_new
It returns as output a container ID, and then exits
After that when I try to open the admin console -
https://localhost:9043/ibm/console/login.do?action=secure
I get an error
This site cannot be reached
localhost refused to connect
Is it because after the docker run command outputs a container id, it exits?
Or something else needs to be done to make the admin console work.
I have referred to instructions here - https://hub.docker.com/r/ibmcom/websphere-traditional/
The only difference is, I have built my own image for windows
Printing the container ID and returning to the shell is normal behavior because you specified -d which runs the container in the background. You should be able to see your container with docker ps.
How long after startup did you wait to try to access the admin console? WAS Base can take several minutes to start up depending on system load and other factors, but docker printing the ID only means the container was created, not that it has finished initializing.
Check that 9043 is the adminhost_secure port, or try using just http:// instead of https:// in the admin console URL.
Can you enter the container with docker exec -it was_test bash, and attempt to access the URL from within the container? wget https://localhost:9043/ibm/console. If you get a message about not trusting the certificate, the server is accepting connections, but for some reason docker isn't forwarding your browser's requests into the container.
These steps should help you narrow down whether it is WAS, or docker, that is not cooperating.
I have created a container using an image which hosts a simple tomcat application.
I used this command:
docker run -d -p 7992:80 <Image_Name>
It ran successfully and gave me the container ID.
Now I have tried hitting http://<host_ip>:7992 as well as http://<container_id> URL. But it keeps saying site cannot be reached.
Am I hitting the wrong IP or what? Where will I see my website?
Please comment if any more information is required.
You can try
docker port <container_id>