You don’t need to make this parameterizable. Pick a port number — whatever the “default” port is for your language framework’s unprivileged HTTP service, for example — and hard-code that in the Dockerfile. If the operator wants to pick a different port to publish, they’ll know what the second number to the docker run -p
option needs to be.
# Dockerfile
...
EXPOSE 8000
CMD ["myserver", "-addr=0.0.0.0:8000"]
# The second port number 8000 is a fixed property of the image
# The operator can pick any number for the published port
docker run -p 3333:8000 ...
You should be able to re-run an identical image in multiple environments; if you need to re-build your image to run it somewhere else, consider trying to make the properties that need to change inputs to the image at runtime, like environment variables, and not things you fix in the Dockerfile.