Create a user directory for Node-RED, usually in ~/.node-red:
$ mkdir ~/.node-red
Optional: put your own settings.js file in this folder to override the default one.
Run the image:
$ sudo docker run --rm -v ~/.node-red/:/root/.node-red -p 1880:1880 -h mynoderedhost nhong/node-red
The -h is important, Node-RED named its flow file after the host name, which is randomized in the case of container. To avoid this randomization, specify the host name with -h option. Otherwise, Node-RED will create a new empty flow every time it starts because it always searches for the flow file that is named after the host name.
The -v mount the created directory to the container's user directory used by Node-RED, this way it keeps the flow stored on local machine as well as makes Node-RED read the custom settings.js configuration.
The -p forward the container's port to the local machine's port