Docker port forwarding not working

前端 未结 5 596
故里飘歌
故里飘歌 2020-12-14 17:17

I have setup Docker container for access my machine docker container to another machine in local.

Create a container below command:

    docker run -i         


        
5条回答
  •  独厮守ぢ
    2020-12-14 18:01

    Partial Answer:

    Now I solved this problem partially, While i try without bash in create a container and change my port to 3000(-p 3000:80) it worked for me.

    Before Command:

         docker run -it -d --name containerName -h www.myhost.net -v /var/www/html -p 3000:80 --net mynetwork --ip 172.11.0.10 --privileged myimagename  bash
    

    After Command:

        docker run -it -d --name containerName -h www.myhost.net -v /var/www/html -p 3000:80 --net mynetwork --ip 172.11.0.10 --privileged myimagename
    

    Then,

    execute the container with bin/bash

      docker exec -it containerName bin/bash
    

    Now , works locally Connected Another machine.

     hostmachineip:3000 
    
    
    I don't know docker have any port restrictions.But This solution works for me.
    

提交回复
热议问题