-p后面直接带网络程序,不大灵活啊。ps -p可以同时开放很多个网络端口么?
It’s okay, but don’t do it. If you have multiple programs, you should open multiple containers. This is the correct posture of docker
Recommended to use docker-compose
Yes.For example, if you use docker to run a nodejs program, the program listens to two ports, such as8080和3443, 你就需要-p 8080:8080 -p 3443:3443
8080
3443
-p 8080:8080 -p 3443:3443
Docker recommends that a container should only run one service
It’s okay, but don’t do it. If you have multiple programs, you should open multiple containers. This is the correct posture of docker
Recommended to use docker-compose
Yes.
For example, if you use docker to run a nodejs program, the program listens to two ports, such as
8080
和3443
, 你就需要-p 8080:8080 -p 3443:3443
Docker recommends that a container should only run one service