私信  •  关注

saeed

saeed 最近回复了

根据 Docker Run Docs :

-P         : Publish all exposed ports to the host interfaces
-p=[]      : Publish a container's port or a range of ports to the host
               format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort
               Both hostPort and containerPort can be specified as a
               range of ports. When specifying ranges for both, the
               number of container ports in the range must match the
               number of host ports in the range, for example:
                   -p 1234-1236:1234-1236/tcp
3 年前
回复了 saeed 创建的主题 » Docker容器状态未启动

你使用了多个 " 在你的指挥下 escape characters ' .你的命令应该是这样的:

docker run -d -it -i -t --name test ubuntu sh -c "echo 'Input website:'; read website; echo 'Searching..'; sleep 1; curl 'http:\\$website;'"

或者:

docker run -d -it -i -t --name test ubuntu sh -c "echo \"Input website:\"; read website; echo \"Searching..\"; sleep 1; curl 'http:\\$website;'"

或者如果它不起作用,你可以改变 http:// http:\/\/ 如果它仍然不起作用,这可能会对你有所帮助。