Unable to connect application on localhost after docker deploymnet is successful

Viewed 159

I am trying to deploy a spring boot war file on docker container

This is my docker file:

FROM tomcat:alpine

RUN wget -O /usr/local/tomcat/webapps/ROOT.war -U admin:Learning http://localhost:8082/artifactory/demoArtifactory/com/demo/0.0.1-SNAPSHOT/demo-0.0.1-SNAPSHOT.war

EXPOSE 8080

CMD ["catalina.sh", "run"]

enter image description here

enter image description here

I am unable to connect to localhost:7000

UPDATE: This is the docker run command:

docker run -it --name demo-application -d -p 8080:8080 hmt/demo-application:49

"PortBindings": {
                "8080/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "8080"
                    }
                ]
            }

Now my tomcat is up on localhost:8080 but I am unable to access my application

UPDATE:

@SpringBootApplication
public class DemoApplication{

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

}
2 Answers

Look at your port information :
The port 9100 of the container is published on the port 7000 on the host.
But look at your log application : it is deployed on 8080 (and not on 9100).
What you want is publishing the container port 8080 on the 7000 port of the host such as :

docker run -p 7000:8080 foo-image
Related