Search code examples
dockernetwork-programmingipwar

Run a .war on a Docker container


I'm running a Java web application on a Docker cluster running those commands:

PS C:\Users\Marco\test_workspace> docker run -v test_web_application.war:/usr/local/tomcat/webapps/TestWebApplication.war -it -p 8080:8080 --network "host" -d Tomcat

The actual output confirms that the container is running:

enter image description here

At this point i want to access to the container through it's IP address from my host and i'm using the command inspect to identify the IP:

enter image description here

But, as the screenshot shows, i don't see any IP assigned.

Thus, my questions are:

Why the command --network "host" to assign an IP address shared with the host didn't worked ?

Finally, how can i access to my web application from the host ?


Solution

  • Command option --network="host" isn't supported for Docker for Windows (more information: https://docs.docker.com/network/host/).
    You can access your application on localhost:8080 with launch option -p 8080:8080.