Question: what is the difference between expose and publish in docker?
Answer: Exposing and publishing ports You expose ports using the EXPOSE keyword in the Dockerfile or the --expose flag to docker run. Exposing ports is a way of documenting which ports are used, but does not actually map or open any ports. ... You publish ports using the --publish or --publish-all flag to docker run .