简体   繁体   中英

Trying to run tomcat8 / rest api app combination in docker container - can't map ports

Good day. I have tomcat 8 and a rest api application I need to run in 4 or 5 containers, for testing of a client process. I already have a tomcat 8 instance on my Windows 10 machine, it connects on port 8080, like tomcat normally does. My container/image tomcat is also set for port 8080, so I can browse to the 'Default Switch' IP address and port 8080, and the tester interface comes up.

But with multiple docker instances need, I'm trying to run docker with: 'docker run -it -p 8081:8080 /bin/bash', so I can start and stop the container tomcat as needed. From my research, using -p 8081:8080 should map the container tomcat port (8080), to my host port 8081, so I can use 'localhost:8081' to browse to the app deployed on the container tomcat.

When I run the above command with -p 8081:8080, I'm getting:

docker: Error response from daemon: driver failed programming external connectivity on endpoint musing_thompson (771e81801b1e20512aff36f6ec25544ca34a03181b8bd3a251f13c3edb328690): Error starting userland proxy: mkdir /port/tcp:0.0.0.0:8081:tcp:172.17.0.2:8080: input/output error.

Is this the correct way to use '-p', or am I mixing up my hosts/ports ?

i was also facing the same problem. so all i did is run this command docker stop $(docker ps -a -q) and restarted the docker. sometimes simply starting the docker also works fine. it worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM