To preface, I'm not a Docker novice (or expert), just unsure how to complete this without blowing up my current container.
I'm playing around with Postgres and spun up a container using this command without realizing it won't expose Postgres outside of Docker
docker run --name postgres -e POSTGRES_PASSWORD=<password> -d postgres
I want to be able to have this data accessible to other systems. I do not want to remove the container since I have quite a bit of configuration already done.
I've tried editing the container hostconfig.json
file in /var/lib/docker/containers
after stopping the instance, but the file gets overwritten after starting the container back up.
What's the best practice to expose a port outside of the container?